Skip to content

Commit

Permalink
avoid any
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Jun 12, 2023
1 parent bf2ec96 commit 8f1cc4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/07_router/src/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ interface Props {
children: ReactNode;
}

class ErrorBoundaryClass extends Component<Props, { error?: any }> {
constructor(props: any) {
class ErrorBoundaryClass extends Component<Props, { error?: unknown }> {
constructor(props: Props) {
super(props);
this.state = {};
}

static getDerivedStateFromError(error: any) {
static getDerivedStateFromError(error: unknown) {
return { error };
}

render() {
if ("error" in this.state) {
// You can render any custom fallback UI
return this.props.fallback(this.state.error);
}
return this.props.children;
Expand Down

0 comments on commit 8f1cc4f

Please sign in to comment.