mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 11:52:00 +00:00
Updating name of variable to which returned value of setState is assigned (#3701)
in CodePen it is 'prevState' and in the tutorial, it is 'state', which creates confusion.
This commit is contained in:
@@ -71,8 +71,8 @@ class Toggle extends React.Component {
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
this.setState(state => ({
|
||||
isToggleOn: !state.isToggleOn
|
||||
this.setState(prevState => ({
|
||||
isToggleOn: !prevState.isToggleOn
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user