Skip to content

Commit 61d10cb

Browse files
committed
Tweaked syntax
1 parent 2fb39d2 commit 61d10cb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ErrorBoundary.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ export class ErrorBoundary extends Component<
2121
PropsWithRef<PropsWithChildren<ErrorBoundaryProps>>,
2222
ErrorBoundaryState
2323
> {
24-
constructor(props: ErrorBoundaryProps ){
24+
constructor(props: ErrorBoundaryProps) {
2525
super(props);
26+
27+
this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
2628
this.state = initialState;
2729
}
2830

@@ -41,7 +43,7 @@ export class ErrorBoundary extends Component<
4143

4244
this.setState(initialState);
4345
}
44-
};
46+
}
4547

4648
componentDidCatch(error: Error, info: ErrorInfo) {
4749
this.props.onError?.(error, info);
@@ -84,7 +86,7 @@ export class ErrorBoundary extends Component<
8486
if (didCatch) {
8587
const props: FallbackProps = {
8688
error,
87-
resetErrorBoundary: this.resetErrorBoundary.bind(this),
89+
resetErrorBoundary: this.resetErrorBoundary,
8890
};
8991

9092
if (isValidElement(fallback)) {
@@ -106,7 +108,7 @@ export class ErrorBoundary extends Component<
106108
value: {
107109
didCatch,
108110
error,
109-
resetErrorBoundary: this.resetErrorBoundary.bind(this),
111+
resetErrorBoundary: this.resetErrorBoundary,
110112
},
111113
},
112114
childToRender

0 commit comments

Comments
 (0)