From 27c82e71df119e96c8467d6c6e28400e12d5a4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jastrz=C4=99bski?= Date: Tue, 30 May 2023 16:53:11 +0200 Subject: [PATCH] Revert "docs: remove outdated FAQ" This reverts commit 400d313087c9ca90e03602d4ec1f546e0d40eeb4. --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 81dbfc7..c963f2d 100644 --- a/README.md +++ b/README.md @@ -180,4 +180,32 @@ const ComponentWithErrorBoundary = withErrorBoundary(ExampleComponent, { --- +# FAQ +## `ErrorBoundary` cannot be used as a JSX component +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.: + +If using NPM: +```json +{ + ... + "overrides": { + "@types/react": "17.0.60" + }, + ... +} +``` + +If using Yarn: +```json +{ + ... + "resolutions": { + "@types/react": "17.0.60" + }, + ... +} +``` + +--- + [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). \ No newline at end of file