You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hook now accepts an `options` object that you can pass a `onDidCatch` callback that gets called when the ErrorBoundary catches an error.
102
+
103
+
```js
104
+
useErrorBoundary({
105
+
onDidCatch: (error, errorInfo) => {
106
+
// For logging/reporting
107
+
},
108
+
})
109
+
```
110
+
93
111
## Returned Properties
94
112
95
113
These are the properties of the returned Object:
@@ -99,7 +117,8 @@ These are the properties of the returned Object:
99
117
|`ErrorBoundary`| React Component | Special error boundary component that provides state changes to the hook. <br>:warning:**You need to use this as the error boundary! Otherwise, the state will not update when errors are catched!** <br> The ErrorBoundary is **guaranteed referential equality** across rerenders. |
100
118
|`didCatch`| Boolean |`true` if an error has been catched |
101
119
|`error`| Error Object or `null`| The error catched by the Boundary |
102
-
|`errorInfo`| Object or `null`| Error Info from the boundary ([React docs](https://reactjs.org/docs/error-boundaries.html)) |
120
+
121
+
If you are searching for the `errorInfo` property, please read [Breaking Changes in 2.x](#breaking-changes-in-2x).
103
122
104
123
## Why should I use this?
105
124
@@ -110,6 +129,6 @@ This packages purpose is to provide an easy drop in replacement for projects tha
110
129
111
130
## Contributing
112
131
113
-
Contributions are welcome, as this is my **first properly published npm package**.
132
+
Contributions are always welcome.
114
133
115
-
Feel free to open issues or pull requests! I will review them as fast as possible.
0 commit comments