React Flashcards

1
Q

Name three basic rules for working with React class objects’ states.

A
  1. Never change this.state directly.
    Always use this.setState(). The only place where you can change this.state is constructor of the component.
  2. Remember that state update might be asynchronous.
    To synchronize them, pass a function into setState(); This function should accept two arguments: the initial state and the updated props. It should return the new state object.
  3. State updates are merged.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly