I am using react hooks forms and has tried most thing to default check a radio button:
<FormGroup tag="fieldset">
<FormGroup check>
<Label check>
<Input type="radio" name="isIBAN" innerRef={register} defaultChecked/> IBAN
</Label>
</FormGroup>
<FormGroup check>
<Label check>
<Input type="radio" name="isIBAN" innerRef={register} value={false} /> BIC/SWIFT
</Label>
</FormGroup>
</FormGroup>
I dont know if you can do it from the default values:
const { register, handleSubmit, errors, setValue, getValues } = useForm(
{
defaultValues:{
accountNr: "XXXXKB20201555555555",
bic:"XXXDKKK",
isIBAN:true
}
}
);
How is the correct way to default the first radio button to checked? I could make another hook but there must be some built in in react hooks forms?