Skip to content

Commit

Permalink
[Docs] Fixed bug in example code (#6828)
Browse files Browse the repository at this point in the history
# Summary

Fixed bug in example code: mutated the previous state without the use of a callback in _setState_
  • Loading branch information
davidblnc authored and thymikee committed Aug 11, 2018
1 parent 9093a3c commit b22a232
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
### Chore & Maintenance

- `[docs]` Document another option to avoid warnings with React 16 ([#5258](https://github.com/facebook/jest/issues/5258))

### Chore & Maintenance

- `[docs]` Add note explaining when `jest.setTimeout` should be called ([#6817](https://github.com/facebook/jest/pull/6817/files))
- `[docs]` Fixed bug in example code ([#6828](https://github.com/facebook/jest/pull/6828))

## 23.4.2

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.0/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class CheckboxWithLabel extends React.Component {
}

onChange() {
this.setState({isChecked: !this.state.isChecked});
this.setState(prevState => ({isChecked: !prevState.isChecked}));
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.1/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class CheckboxWithLabel extends React.Component {
}

onChange() {
this.setState({isChecked: !this.state.isChecked});
this.setState(prevState => ({isChecked: !prevState.isChecked}));
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.2/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class CheckboxWithLabel extends React.Component {
}

onChange() {
this.setState({isChecked: !this.state.isChecked});
this.setState(prevState => ({isChecked: !prevState.isChecked}));
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.3/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class CheckboxWithLabel extends React.Component {
}

onChange() {
this.setState({isChecked: !this.state.isChecked});
this.setState(prevState => ({isChecked: !prevState.isChecked}));
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.4/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class CheckboxWithLabel extends React.Component {
}

onChange() {
this.setState({isChecked: !this.state.isChecked});
this.setState(prevState => ({isChecked: !prevState.isChecked}));
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-23.0/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default class CheckboxWithLabel extends React.Component {
}

onChange() {
this.setState({isChecked: !this.state.isChecked});
this.setState(prevState => ({isChecked: !prevState.isChecked}));
}

render() {
Expand Down

0 comments on commit b22a232

Please sign in to comment.