1. React this binding assembly
Since this is not point in JSX current object, so the need tobind
Reference article:
- [Translation] Why do you need in class components bound React to this event handler
- React why you want to bind this
2. controlled and non-controlled assembly components
in short,
-
The controlled components
for example, each time it will change state corresponding to a value
- Uncontrolled
us usually written in a form similar to the real data is stored in the DOM node, only when submitted, will get the value of the form - How to choose?
According to their project requirements, personal understanding is, if you want to do real-time verification, then it is a controlled components;
If the form is relatively simple, then it is a non-controlled components, relatively speaking, reducing the amount of code related onChange.
Reference article: