About
A React form 1) is the implementation of HTML form elements with HTML React elements
It works a little bit differently from other DOM elements in React, because form elements naturally keep some internal state.
State controller
In React, there are 2 ways to create and manipulate the value of the forms. If the value is controlled:
- by React: controlled_component
- by the Browser HTML Dom: uncontrolled_component
Controlled Component
A controlled component is a form where the values are controlled by React.
All accept a value attribute that is used to implement a controlled component.
Uncontrolled component
An uncontrolled component is a React form where the values are stored in the value property of the HTML form control element (input, text area, select, …))
React Control Element
React wraps form control element.
See the following control element in React.
Library
Library try to help:
- Getting values in and out of form state
- Validation and error messages
- Handling form submission
List:
-
- Formik is built on the same principles of controlled components and managing state
- https://github.com/rjsf-team/react-jsonschema-form - form from json
- react-select