Skip to main content

What are the differences between controlled and uncontrolled components?

Published 1 min readMarkdown
Part of seriesReact
What are the differences between controlled and
uncontrolled components?

Controlled Component:

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.

Uncontrolled component:

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.

Sources:

Difference between Controlled and Uncontrolled. (2022, August 7). W3schools. https://www.w3schools.blog/difference-between-controlled-and-uncontrolled

About the author

  • Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference

No comments yet. Be the first to comment.

More from this blog