I am quiet new to React Hook Forms. I am trying integrate Material UI with react hook forms. I am avoiding the use of normal submit rather using onClick on a button to trigger submit, I am using controller but for some reason when I submit my values always reflect default values and not the actual values on the input.
<Controller
name={name}
control={control}
defaultValue={defaultValue}
render={() => (
<QControl
uiProp={uiProp}
context={context}
handleChange={handleChange}
/>
)}
/>
<Button
type="submit"
className="form-actions"
variant="contained"
color="primary"
startIcon={<SaveIcon />}
onClick={onSubmission}
>
const { control, handleSubmit } = useForm();
const onSubmit = (data) => console.log(data);
const onSubmission = handleSubmit(onSubmit);
Aucun commentaire:
Enregistrer un commentaire