It provides better control over the elements and data of the form. The flow of a Controlled Component in ReactJS In a controlled component, the form element's data is handled by the React component (not DOM) and kept in the component's state. I prefer women who cook good food, who speak three languages, and who go mountain hiking - what if it is a woman who only has one of the attributes? Controlled vs Uncontrolled Components React supports two types of components: controlled components and uncontrolled components. When a state update occurs via setState(), it causes the component to re-render and the newly entered value is displayed in the element. which takes matter into their own hand. Here we have a simple component that renders one textbox on the page and echos back whatever the user types in the textbox. Templates let you quickly answer FAQs or store snippets for re-use. But in uncontrolled component, form data is handled by DOM itself. What's the need for 'value' attribute in an input tag in react? class Form extends React.Component { constructor (props) { super (props); this.onChange = this.onChange.bind (this); this.state = { name . When setting these element's value to use state, we have wrapped up the control for both the rendering of the form as well as future input of the form into the same React component. Warning: A component is changing a controlled input of type checkbox to be uncontrolled. What is React Controlled Vs Uncontrolled Component? React Controlled Vs. Uncontrolled Component Controlled Component. image. Here is a very good example of how things get a lot more complicated if you decide to go with the uncontrolled components. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, @IvankaTodorova For a controlled component the value is passed in through, The difference between them is that components that their value is set/passed and have a callback are called, How would you call a component that gets it. TL;DR. Uncontrolled components and Controlled components differ in the way they access the data from the form elements (,