Controlled Components

  In HTML, form elements such as <input><textarea>, and <select> typically maintain their own state and update it based on user input. In React, mutable state is typically kept in the state property of components, and only updated with setState().

  We can combine the two by making the React state be the "single source of truth". Then the React component that renders a form also controls what happens in that form on subsequent user input. An input form element whose value is controlled by React in this way is called a "controlled component".

  Controlled Components

参考:https://facebook.github.io/react/docs/forms.html#controlled-components

相关文章:

  • 2021-06-21
  • 2021-12-04
  • 2022-12-23
  • 2021-07-18
  • 2021-11-15
  • 2021-09-18
  • 2021-07-22
猜你喜欢
  • 2022-12-23
  • 2022-01-16
  • 2021-06-02
  • 2021-09-01
  • 2021-12-31
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案