forked from Navy.gif/webserver-framework-frontend
fix error boundary
This commit is contained in:
parent
d228597d0e
commit
ae2a4ddbcc
@ -8,12 +8,12 @@ class ErrorBoundary extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidCatch(error, errorInfo) {
|
componentDidCatch(error, errorInfo) {
|
||||||
this.sate.error = true;
|
this.setState({error: true});
|
||||||
console.log(error, errorInfo);
|
console.error(error, errorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.error) return <h1>Something went wrong :(</h1>;
|
if (this.state.error) return <h1>Something went wrong :/</h1>;
|
||||||
return this.props.children;
|
return this.props.children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user