Skip to content

Commit

Permalink
chore(docs): Use callback in setState in Collapse examples (#1423)
Browse files Browse the repository at this point in the history
* Use callback in setState when referencing the previous state

* Use callback in setState when referencing the previous state
  • Loading branch information
antoinegag authored and TheSharpieOne committed Mar 5, 2019
1 parent 33cfce6 commit fc2ce2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/lib/examples/Collapse.js
Expand Up @@ -9,7 +9,7 @@ class Example extends Component {
}

toggle() {
this.setState({ collapse: !this.state.collapse });
this.setState(state => ({ collapse: !state.collapse }));
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion docs/lib/examples/CollapseEvents.js
Expand Up @@ -29,7 +29,7 @@ class Example extends Component {
}

toggle() {
this.setState({ collapse: !this.state.collapse });
this.setState(state => ({ collapse: !state.collapse }));
}

render() {
Expand Down

0 comments on commit fc2ce2e

Please sign in to comment.