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
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]