Skip to content

Commit c02d7b5

Browse files
committed
updated typescript and deconstructing assignment in ErrorHandler.tsx
1 parent 945b778 commit c02d7b5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/app/components/ErrorHandler.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import React from 'react';
22

33
class ErrorHandler extends React.Component {
4-
constructor(props:any) {
4+
constructor(props:unknown) {
55
super(props);
66
this.state = { errorOccurred: false };
77
}
88

9-
componentDidCatch(error:string, info:string) {
9+
componentDidCatch(error: string, info: string): void {
1010
this.setState({ errorOccurred: true });
1111
}
1212

13-
render() {
14-
return this.state.errorOccurred ? <div>Unexpected Error</div> : this.props.children
13+
render(): JSX.Element {
14+
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;
1518
}
1619
}
1720

0 commit comments

Comments
 (0)