We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 945b778 commit c02d7b5Copy full SHA for c02d7b5
src/app/components/ErrorHandler.tsx
@@ -1,17 +1,20 @@
1
import React from 'react';
2
3
class ErrorHandler extends React.Component {
4
- constructor(props:any) {
+ constructor(props:unknown) {
5
super(props);
6
this.state = { errorOccurred: false };
7
}
8
9
- componentDidCatch(error:string, info:string) {
+ componentDidCatch(error: string, info: string): void {
10
this.setState({ errorOccurred: true });
11
12
13
- render() {
14
- return this.state.errorOccurred ? <div>Unexpected Error</div> : this.props.children
+ render(): JSX.Element {
+ const { errorOccurred } = this.state;
15
+ // eslint-disable-next-line react/prop-types
16
+ const { children } = this.props;
17
+ return errorOccurred ? <div>Unexpected Error</div> : children;
18
19
20
0 commit comments