The following will not change the value of the checkbox to true or false, it seems to be stuck on true.
So even if a user does not want to agree to the terms it is making it look like the user has not unclicked the checkbox (yes the checkbox does remove the tick tho)
I am wondering what do I need to change in the following to get it to update the const.
const [state, setState] = React.useState({
marriedstatus: '',
employmentstatus: '',
dependants: '',
income:'',
firsthomebuyer:'',
interest:'',
whentobuild:'',
firstname: '',
lastname:'',
email:'',
mobile:'',
state:'',
suburb:'',
country:'',
besttimetocall:'',
agree: false,
});
const handleChange = name => event => {
setState({
...state,
[name]: event.target.value,
});
};
<Grid item lg={6} xs={12}>
<Controller as={<FormControl variant="outlined" fullWidth="true">
<InputLabel ref={inputLabel} htmlFor="agree">
Agree
</InputLabel><Checkbox
name="agree"
value={state.agree}
checked={true}
onChange={handleChange('agree')}
inputProps=aria-label
/></FormControl>} name="Agree" control={control} />
</Grid>
Aucun commentaire:
Enregistrer un commentaire