Skip to content

Commit 8fafb77

Browse files
committed
Add FAQ for @types/react
1 parent dc357f0 commit 8fafb77

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,32 @@ const ComponentWithErrorBoundary = withErrorBoundary(ExampleComponent, {
180180

181181
---
182182

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+
183211
[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).

0 commit comments

Comments
 (0)