react-error-boundary 4.0.8 → 4.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -180,4 +180,32 @@ const ComponentWithErrorBoundary = withErrorBoundary(ExampleComponent, {
|
|
|
180
180
|
|
|
181
181
|
---
|
|
182
182
|
|
|
183
|
+
# FAQ
|
|
184
|
+
## `ErrorBoundary` cannot be used as a JSX component
|
|
185
|
+
This error can be caused by a version mismatch between [react](https://npmjs.com/package/react) and [@types/react](https://npmjs.com/package/@types/react). To fix this, ensure that both match exactly, e.g.:
|
|
186
|
+
|
|
187
|
+
If using NPM:
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
...
|
|
191
|
+
"overrides": {
|
|
192
|
+
"@types/react": "17.0.60"
|
|
193
|
+
},
|
|
194
|
+
...
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
If using Yarn:
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
...
|
|
202
|
+
"resolutions": {
|
|
203
|
+
"@types/react": "17.0.60"
|
|
204
|
+
},
|
|
205
|
+
...
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
183
211
|
[This blog post](https://kentcdodds.com/blog/use-react-error-boundary-to-handle-errors-in-react) shows more examples of how this package can be used, although it was written for the [version 3 API](https://github.com/bvaughn/react-error-boundary/releases/tag/v3.1.4).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ErrorInfo, PropsWithChildren, PropsWithRef
|
|
1
|
+
import { Component, ErrorInfo, PropsWithChildren, PropsWithRef } from "react";
|
|
2
2
|
import { ErrorBoundaryProps } from "./types.js";
|
|
3
3
|
type ErrorBoundaryState = {
|
|
4
4
|
didCatch: boolean;
|
|
@@ -13,6 +13,6 @@ export declare class ErrorBoundary extends Component<PropsWithRef<PropsWithChild
|
|
|
13
13
|
resetErrorBoundary(...args: any[]): void;
|
|
14
14
|
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
15
15
|
componentDidUpdate(prevProps: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
|
|
16
|
-
render():
|
|
16
|
+
render(): import("react").FunctionComponentElement<import("react").ProviderProps<import("./ErrorBoundaryContext.js").ErrorBoundaryContextType | null>>;
|
|
17
17
|
}
|
|
18
18
|
export {};
|