I am trying to deliver the value of the checkbox using react-hook-form.
I am delivering the register function of react-hook-form to the props of the component.
But here's a problem.
<CheckboxInput
type="checkbox"
id={id}
value="BAD"
checked={isChecked[1]}
onChange={handleCheckbox}
{...register}
/>
If I deliver the props in the above order, the value value of the checkbox is well shown through the watch function of react-hook-form, but the check mark in the checkbox is not appear.
But,
<CheckboxInput
{...register}
type="checkbox"
id={id}
value="BAD"
checked={isChecked[1]}
onChange={handleCheckbox}
/>
If I pass the props in the above order, the check mark in the checkbox appears well, but if I check the value of the checkbox through the watch function in the react-hook-form, only the value 'false' appears.
How can I make sure that the check marks on the checkbox come out well and the exact value comes out?
Aucun commentaire:
Enregistrer un commentaire