Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
REACT_MISUSED_UPDATE_IN_SET_STATE, fix wuhan2020#440
  • Loading branch information
pengcc committed Mar 15, 2020
1 parent 5b80794 commit d033485
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/components/sidemenu/index.jsx
Expand Up @@ -11,11 +11,10 @@ class SideMenu extends React.Component {
};
}

toggleMenuBody = () => {
this.setState({
menuBodyVisible: !this.state.menuBodyVisible,
});
}
toggleMenuBody = () => void this.setState((prevState) => ({
menuBodyVisible: !prevState.menuBodyVisible,
}));


render() {
const { dataSource } = this.props;
Expand Down
10 changes: 4 additions & 6 deletions src/components/sidemenu/item.jsx
Expand Up @@ -26,12 +26,10 @@ class Item extends React.Component {
e.stopPropagation();
}

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

toggle = () => void this.setState( prevState => ({
opened: !prevState.opened,
}) );

renderSubMenu = (data) => {
return (
<ul>
Expand Down

0 comments on commit d033485

Please sign in to comment.