'onChange not woking inside react hook form controller
I want to get the value when box is checked and when submit button is , on submit I am getting the value but not when its checked
<Controller
control={control}
name="test"
render={({
field: { onChange, onBlur, value, name, ref },
fieldState: { invalid, isTouched, isDirty, error },
formState,
}) => (
<Checkbox
onBlur={onBlur} // notify when input is touched
onChange={( event ) => alert(event.target.value)}
checked={value}
inputRef={ref}
/>
)}
/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
