Component API Flashcards

1
Q

setState()

A

Triggers UI update. Does a shallow merge of new state into old

params: nextState[, callback]

  • nextState
    function(prevState, props) or object
  • callback
    called after setState is completed and component is rerendered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

forceUpdate()

A

Force rerender even if setState() hasn’t been called. This is used for non-pure components (which use things other than this.props and this.state)

params: [callback]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly