Skip to content

Commit cca74be

Browse files
committed
ref: #187 adding formik pendind setLoginInfo
1 parent b684694 commit cca74be

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

hooks/14_FormValidation/src/pages/loginFormComponent.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,21 @@ export const LoginForm: React.FC<PropsForm> = (props) => {
2727
const classes = useFormStyles();
2828
const { onLogin, onUpdateField, loginInfo } = props;
2929

30-
// TODO: Enhacement move this outside the stateless component discuss why is a good idea
31-
const onTexFieldChange = (fieldID) => (e) => {
32-
onUpdateField(fieldID, e.target.value);
33-
};
34-
3530
return (
3631
<Form>
3732
<div className={classes.formContainer}>
3833
<TextFieldForm
3934
label="Name"
4035
name="login"
4136
value={loginInfo.login}
42-
onChange={onTexFieldChange("login")}
37+
onChange={onUpdateField}
4338
/>
4439
<TextFieldForm
4540
label="Password"
4641
type="password"
4742
name="password"
4843
value={loginInfo.password}
49-
onChange={onTexFieldChange("password")}
44+
onChange={onUpdateField}
5045
/>
5146
<Button variant="contained" color="primary" onClick={onLogin}>
5247
Login

0 commit comments

Comments
 (0)