@@ -70,12 +70,11 @@ its descendants too.
70
70
``` jsx
71
71
import {ErrorBoundary } from ' react-error-boundary'
72
72
73
- function ErrorFallback ({error, componentStack, resetErrorBoundary}) {
73
+ function ErrorFallback ({error, resetErrorBoundary}) {
74
74
return (
75
75
< div role= " alert" >
76
76
< p> Something went wrong: < / p>
77
77
< pre> {error .message }< / pre>
78
- < pre> {componentStack}< / pre>
79
78
< button onClick= {resetErrorBoundary}> Try again< / button>
80
79
< / div>
81
80
)
@@ -98,7 +97,7 @@ You can react to errors (e.g. for logging) by providing an `onError` callback:
98
97
``` jsx
99
98
import {ErrorBoundary } from ' react-error-boundary'
100
99
101
- const myErrorHandler = (error : Error , componentStack : string ) => {
100
+ const myErrorHandler = (error : Error , info : { componentStack: string} ) => {
102
101
// Do something with the error
103
102
// E.g. log to an error logging client here
104
103
}
@@ -118,7 +117,7 @@ import {withErrorBoundary} from 'react-error-boundary'
118
117
119
118
const ComponentWithErrorBoundary = withErrorBoundary (ComponentThatMayError, {
120
119
FallbackComponent: ErrorBoundaryFallbackComponent,
121
- onError (error , componentStack ) {
120
+ onError (error , info ) {
122
121
// Do something with the error
123
122
// E.g. log to an error logging client here
124
123
},
@@ -135,12 +134,11 @@ ErrorBoundary's internal state. You can do this various ways, but here's the
135
134
most idiomatic approach:
136
135
137
136
``` jsx
138
- function ErrorFallback ({error, componentStack, resetErrorBoundary}) {
137
+ function ErrorFallback ({error, resetErrorBoundary}) {
139
138
return (
140
139
< div role= " alert" >
141
140
< p> Something went wrong: < / p>
142
141
< pre> {error .message }< / pre>
143
- < pre> {componentStack}< / pre>
144
142
< button onClick= {resetErrorBoundary}> Try again< / button>
145
143
< / div>
146
144
)
@@ -198,9 +196,9 @@ error that React can handle within the children of the `ErrorBoundary`, the
198
196
#### ` FallbackComponent `
199
197
200
198
This is a component you want rendered in the event of an error. As props it will
201
- be passed the ` error ` , ` componentStack ` , and ` resetErrorBoundary ` (which will
202
- reset the error boundary's state when called, useful for a "try again" button
203
- when used in combination with the ` onReset ` prop).
199
+ be passed the ` error ` and ` resetErrorBoundary ` (which will reset the error
200
+ boundary's state when called, useful for a "try again" button when used in
201
+ combination with the ` onReset ` prop).
204
202
205
203
This is required if no ` fallback ` or ` fallbackRender ` prop is provided.
206
204
@@ -210,8 +208,7 @@ This is a render-prop based API that allows you to inline your error fallback UI
210
208
into the component that's using the ` ErrorBoundary ` . This is useful if you need
211
209
access to something that's in the scope of the component you're using.
212
210
213
- It will be called with an object that has ` error ` , ` componentStack ` , and
214
- ` resetErrorBoundary ` :
211
+ It will be called with an object that has ` error ` and ` resetErrorBoundary ` :
215
212
216
213
``` jsx
217
214
const ui = (
@@ -264,7 +261,7 @@ const ui = (
264
261
#### ` onError `
265
262
266
263
This will be called when there's been an error that the ` ErrorBoundary ` has
267
- handled. It will be called with two arguments: ` error ` , ` componentStack ` .
264
+ handled. It will be called with two arguments: ` error ` , ` info ` .
268
265
269
266
#### ` onReset `
270
267
0 commit comments