File tree Expand file tree Collapse file tree
hooks/14_FormValidation/src/pages Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments