Skip to content

Commit

Permalink
Docs: added note about setState() side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
julen committed Jul 31, 2014
1 parent db6e07e commit 1219663
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/docs/ref-02-component-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Merges nextState with the current state. This is the primary method you use to t
> `setState()` does not immediately mutate `this.state` but creates a pending state transition. Accessing `this.state` after calling this method can potentially return the existing value.
>
> There is no guarantee of synchronous operation of calls to `setState` and calls may be batched for performance gains.
>
> `setState()` will always trigger a re-render unless conditional rendering logic is implemented in `shouldComponentUpdate()`. If mutable objects are being used and the logic cannot be implemented in `shouldComponentUpdate()`, calling `setState()` only when the new state differs from the previous state will avoid unnecessary re-renders.


### replaceState
Expand Down

0 comments on commit 1219663

Please sign in to comment.