dotkom / design-system

Component library, maybe
https://design.online.ntnu.no
MIT License
4 stars 4 forks source link

Warning: A component is changing an uncontrolled input of type text to be controlled #198

Open FluidSense opened 3 years ago

FluidSense commented 3 years ago

Describe the bug When using a TextField, I get the warning:

Warning: A component is changing an uncontrolled input of type text 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

If I change to not controlling it with a value, the input is never displayed and the onChange triggers with only 1 letter at a time instead of concatinating the input every time.

Expected behavior Either displaying input iteratively and always returning the entire state of the input field on onChange, or just let me control it without warnings.