Open super918180 opened 6 years ago
Could you reproduce your issue on https://codesandebox.io?
Reproduced with the demo in the README.md
https://codesandbox.io/s/xzj4npj4k4
Official demos have the same issue
http://react-component.github.io/form/examples/across-router.html#/
Just enter a value into an input and the warning appears
Just set initialValue
for the input.
But I'd like the value in the form to an have undefined value, as the field is optional
For my use case I have a number field that is optional, but if the user selects a value it must be >0. If I set the initialValue to undefined I get the same error, and if I set it to ""
(which the react warnings say you should if you want it to be empty) the number field's value is a string.
I use rc-ffrm in React 16.3, and get warning as this: A component is changing an uncontrolled input of type undefined to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components