in ReactJS by (1.4k points)

What are controlled and uncontrolled components in React?

1 Answer

0 votes
by (1.4k points)
  • Controlled Component is one that takes its current value through props and notifies changes through callbacks like onChange. A parent component “controls” it by handling the callback and managing its own state and passing the new values as props to the controlled component. You could also call this a “dumb component”.
  • A Uncontrolled Component is one that stores its own state internally, and you query the DOM using a ref to find its current value when you need it. This is a bit more like traditional HTML.

Related questions

0 votes
asked Jul 2, 2019 in ReactJS by Venkatshastri (1.4k points)