Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What are controlled and uncontrolled components in React?
Home
ReactJS
What are controlled and uncontrolled components in React?
asked
Jul 2, 2019
in
ReactJS
by
Venkatshastri
What are controlled and uncontrolled components in React?
#reactjs
#redux
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jul 2, 2019
by
Venkatshastri
A
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.
...