Open leesei opened 1 year ago
When checking "A", "C", the controlled field will return ["a",null,"c"] upon submit. https://react-hook-form.com/docs/usecontroller
["a",null,"c"]
Code Sandbox: https://codesandbox.io/s/usecontroller-checkboxes-99ld4?file=/src/App.js
I improved the example using Set: https://codesandbox.io/s/usecontroller-checkboxes-forked-dfxcln?file=/src/App.js
Set
Background issue: https://github.com/react-hook-form/react-hook-form/issues/476
I'm not sure whether the original behavior is intentional. At least it doesn't match the behavior of uncontrolled component. Shall Set be adopted?
When checking "A", "C", the controlled field will return
["a",null,"c"]
upon submit. https://react-hook-form.com/docs/usecontrollerCode Sandbox: https://codesandbox.io/s/usecontroller-checkboxes-99ld4?file=/src/App.js
I improved the example using
Set
: https://codesandbox.io/s/usecontroller-checkboxes-forked-dfxcln?file=/src/App.jsBackground issue: https://github.com/react-hook-form/react-hook-form/issues/476
I'm not sure whether the original behavior is intentional. At least it doesn't match the behavior of uncontrolled component. Shall
Set
be adopted?