replace getDerivedStateFromProps with componentDidUpdate

This commit is contained in:
or-else
2019-08-12 11:51:44 +03:00
parent d2975f0c20
commit a79373c8cd
5 changed files with 18 additions and 15 deletions
+6 -4
View File
@@ -13,10 +13,12 @@ export default class ErrorPanel extends React.PureComponent {
this.hide = this.hide.bind(this);
}
static getDerivedStateFromProps(nextProps, prevState) {
return {
show: !(!nextProps.level)
};
componentDidUpdate(prevProps) {
if (prevProps.level !== this.props.level) {
this.setState({
show: !(!this.props.level)
});
}
}
hide() {