Photo by Lautaro Andreani on Unsplash
What are the differences between controlled and uncontrolled components?
·Aug 29, 2022·
1 min read
Unlike the uncontrolled component, the input form element in the controlled component is handled by the component rather than the DOM. It takes its current value through props. The changes are notified through callbacks.
Similar to the traditional HTML form inputs, the uncontrolled component can be written using a ref to get form values from the DOM. Thus there is no need to write an event handler for every state update and the HTML elements maintain their own state that will be updated when the input value changes.
Difference between Controlled and Uncontrolled. (2022, August 7). W3schools. w3schools.blog/difference-between-controlle..