-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
Description
Bug report
Current Behavior
After updating to React 19 creating a form with a checkbox and not providing initial values will cause the checkbox to go into multi mode and change from using true/false values to using ['on']/[] as values.
Current result on submit: [{"myCheckbox":["on"]},{}]
Expected behavior
Using same code with React 18.3.1 the result is this: [{"myCheckbox":true},{}]
Reproducible example
How to reproduce in examples:
- Click checkbox
- Click submit
- Inspect resulting alert
Example with React 19: https://codesandbox.io/p/sandbox/formik-checkbox-bug-reproduction-96p8gs
Example with React 18: https://codesandbox.io/p/sandbox/yc6ss2
Suggested solution(s)
I have not looked into the Formik code so I don't have a suggestion for a code fix.
Additional context
N/A
Your environment
Check code sandbox examples
erikpetzold and melisa-at-levelpath