react-hook-form input radio not having a default value supplied
Hey! I'm having an issue with RHF (react-hook-form) and controlled radio input. The default value supplied by useForm does not results in radio button being checked by default.
I figured a workaround by supplying defaultChecked with a comparison with a default value, but that feels hacky.
If I try with uncontrolled inputs (vanilla html inputs), then the default value is supplied correctly.
https://codesandbox.io/p/sandbox/modern-hooks-wd874l
RHF input:radio default value
CodeSandbox is an online editor tailored for web applications.
0 Replies