File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,16 @@ export class ErrorBoundary extends Component<
21
21
PropsWithRef < PropsWithChildren < ErrorBoundaryProps > > ,
22
22
ErrorBoundaryState
23
23
> {
24
- state = initialState ;
24
+ constructor ( props : ErrorBoundaryProps ) {
25
+ super ( props ) ;
26
+ this . state = initialState ;
27
+ }
25
28
26
29
static getDerivedStateFromError ( error : Error ) {
27
30
return { didCatch : true , error } ;
28
31
}
29
32
30
- resetErrorBoundary = ( ...args : any [ ] ) => {
33
+ resetErrorBoundary ( ...args : any [ ] ) {
31
34
const { error } = this . state ;
32
35
33
36
if ( error !== null ) {
@@ -81,7 +84,7 @@ export class ErrorBoundary extends Component<
81
84
if ( didCatch ) {
82
85
const props : FallbackProps = {
83
86
error,
84
- resetErrorBoundary : this . resetErrorBoundary ,
87
+ resetErrorBoundary : this . resetErrorBoundary . bind ( this ) ,
85
88
} ;
86
89
87
90
if ( isValidElement ( fallback ) ) {
@@ -103,7 +106,7 @@ export class ErrorBoundary extends Component<
103
106
value : {
104
107
didCatch,
105
108
error,
106
- resetErrorBoundary : this . resetErrorBoundary ,
109
+ resetErrorBoundary : this . resetErrorBoundary . bind ( this ) ,
107
110
} ,
108
111
} ,
109
112
childToRender
You can’t perform that action at this time.
0 commit comments