How do you determine whether React components are controlled or not?

Asked 1 years ago, Updated 1 years ago, 348 views

I'm studying about React.

There is something I do not understand about the control and non-control components of React.
How does a component with React determine whether it is controlled or not?

Looking at the official document, I got the impression that it depends on whether or not to use ref.
Please let me know if there are any other criteria.

reactjs

2022-12-05 08:41

1 Answers

I understand the difference between the two below.

  • Control Components: Form data is handled by React components (manage by components such as useState).
  • Uncontrolled components: DOM handles form data itself (using ref to obtain its value)

"If you look at the official document, you may have already read it, but I will attach a reference link

"


2022-12-05 09:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.