What are controlled components in react

WBOY
Release: 2022-04-21 16:51:20
Original
2128 people have browsed it

In React, a controlled component is a component that uses state to get and set the value of an input element; it can also be understood that the React component that renders the form also controls the operations that occur on the form during the user input process, and is used by React to Form input elements that control their values ​​in this way are called controlled components.

What are controlled components in react

The operating environment of this tutorial: Windows 10 system, react17.0.1 version, Dell G3 computer.

What are controlled components in react

The React official website explains controlled components like this: The React component that renders the form also controls the operations that occur on the form during user input. Form input elements whose values ​​are controlled by React in this way are called "controlled components".

Components that use state to get and set input element values ​​are called controlled components. Tags such as ,