{"id":13469691,"url":"https://github.com/bvaughn/react-error-boundary","last_synced_at":"2026-01-05T05:13:28.544Z","repository":{"id":37849528,"uuid":"97559842","full_name":"bvaughn/react-error-boundary","owner":"bvaughn","description":"Simple reusable React error boundary component","archived":false,"fork":false,"pushed_at":"2025-06-22T20:05:03.000Z","size":619,"stargazers_count":7657,"open_issues_count":1,"forks_count":219,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-09-03T16:53:08.084Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bvaughn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"bvaughn","patreon":null,"open_collective":"brianvaughn","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"bvaughn","custom":null}},"created_at":"2017-07-18T06:16:45.000Z","updated_at":"2025-09-03T12:10:21.000Z","dependencies_parsed_at":"2022-07-13T15:29:44.223Z","dependency_job_id":"9feec589-29e6-418f-bb67-41c0b874e5d2","html_url":"https://github.com/bvaughn/react-error-boundary","commit_stats":{"total_commits":147,"total_committers":42,"mean_commits":3.5,"dds":0.6190476190476191,"last_synced_commit":"0a10d4c6dc7908cf3a18d287d4a9bd1368d712d4"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"purl":"pkg:github/bvaughn/react-error-boundary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Freact-error-boundary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Freact-error-boundary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Freact-error-boundary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Freact-error-boundary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bvaughn","download_url":"https://codeload.github.com/bvaughn/react-error-boundary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Freact-error-boundary/sbom","scorecard":{"id":259504,"data":{"date":"2025-08-11","repo":{"name":"github.com/bvaughn/react-error-boundary","commit":"321b4455bc222bdc06a504ae8edb099f58eae152"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":5,"reason":"Found 15/30 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/bvaughn/react-error-boundary/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/bvaughn/react-error-boundary/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/bvaughn/react-error-boundary/ci.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-7q7g-4xm8-89cq","Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-m95q-7qp3-xv42"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T10:30:07.120Z","repository_id":37849528,"created_at":"2025-08-17T10:30:07.120Z","updated_at":"2025-08-17T10:30:07.120Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273494590,"owners_count":25115803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T15:01:51.040Z","updated_at":"2026-01-05T05:13:28.518Z","avatar_url":"https://github.com/bvaughn.png","language":"TypeScript","readme":"# react-error-boundary\n\nReusable React [error boundary](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary) component. Supports all React renderers (including React DOM and React Native).\n\n### If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [buy me a coffee](http://givebrian.coffee/)\n\n## Getting started\n\n```sh\n# npm\nnpm install react-error-boundary\n\n# pnpm\npnpm add react-error-boundary\n\n# yarn\nyarn add react-error-boundary\n```\n\n## API\n\n### `ErrorBoundary` component\nWrap an `ErrorBoundary` component around other React components to \"catch\" errors and render a fallback UI. The component supports several ways to render a fallback (as shown below).\n\n\u003e **Note** `ErrorBoundary` is a _client_ component. You can only pass props to it that are serializeable or use it in files that have a `\"use client\";` directive.\n\n#### `ErrorBoundary` with `fallback` prop\nThe simplest way to render a default \"something went wrong\" type of error message.\n```js\n\"use client\";\n\nimport { ErrorBoundary } from \"react-error-boundary\";\n\n\u003cErrorBoundary fallback={\u003cdiv\u003eSomething went wrong\u003c/div\u003e}\u003e\n  \u003cExampleApplication /\u003e\n\u003c/ErrorBoundary\u003e\n```\n#### `ErrorBoundary` with `fallbackRender` prop\n[\"Render prop\"](https://react.dev/reference/react/Children#calling-a-render-prop-to-customize-rendering) function responsible for returning a fallback UI based on a thrown value.\n```js\n\"use client\";\n\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nfunction fallbackRender({ error, resetErrorBoundary }) {\n  // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n  return (\n    \u003cdiv role=\"alert\"\u003e\n      \u003cp\u003eSomething went wrong:\u003c/p\u003e\n      \u003cpre style={{ color: \"red\" }}\u003e{error.message}\u003c/pre\u003e\n    \u003c/div\u003e\n  );\n}\n\n\u003cErrorBoundary\n  fallbackRender={fallbackRender}\n  onReset={(details) =\u003e {\n    // Reset the state of your app so the error doesn't happen again\n  }}\n\u003e\n  \u003cExampleApplication /\u003e\n\u003c/ErrorBoundary\u003e;\n```\n#### `ErrorBoundary` with `FallbackComponent` prop\nReact component responsible for returning a fallback UI based on a thrown value.\n```js\n\"use client\";\n\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nfunction Fallback({ error, resetErrorBoundary }) {\n  // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n  return (\n    \u003cdiv role=\"alert\"\u003e\n      \u003cp\u003eSomething went wrong:\u003c/p\u003e\n      \u003cpre style={{ color: \"red\" }}\u003e{error.message}\u003c/pre\u003e\n    \u003c/div\u003e\n  );\n}\n\n\u003cErrorBoundary\n  FallbackComponent={Fallback}\n  onReset={(details) =\u003e {\n    // Reset the state of your app so the error doesn't happen again\n  }}\n\u003e\n  \u003cExampleApplication /\u003e\n\u003c/ErrorBoundary\u003e;\n```\n\n#### Logging errors with `onError`\n\n```js\n\"use client\";\n\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nconst logError = (error: Error, info: { componentStack: string }) =\u003e {\n  // Do something with the error, e.g. log to an external API\n};\n\nconst ui = (\n  \u003cErrorBoundary FallbackComponent={ErrorFallback} onError={logError}\u003e\n    \u003cExampleApplication /\u003e\n  \u003c/ErrorBoundary\u003e\n);\n```\n\n### `useErrorBoundary` hook\nConvenience hook for imperatively showing or dismissing error boundaries.\n\n#### Show the nearest error boundary from an event handler\n\nReact only handles errors thrown during render or during component lifecycle methods (e.g. effects and did-mount/did-update). Errors thrown in event handlers, or after async code has run, will not be caught.\n\nThis hook can be used to pass those errors to the nearest error boundary:\n\n```js\n\"use client\";\n\nimport { useErrorBoundary } from \"react-error-boundary\";\n\nfunction Example() {\n  const { showBoundary } = useErrorBoundary();\n\n  useEffect(() =\u003e {\n    fetchGreeting(name).then(\n      response =\u003e {\n        // Set data in state and re-render\n      },\n      error =\u003e {\n        // Show error boundary\n        showBoundary(error);\n      }\n    );\n  });\n\n  // Render ...\n}\n```\n\n#### Dismiss the nearest error boundary\nA fallback component can use this hook to request the nearest error boundary retry the render that originally failed.\n\n```js\n\"use client\";\n\nimport { useErrorBoundary } from \"react-error-boundary\";\n\nfunction ErrorFallback({ error }) {\n  const { resetBoundary } = useErrorBoundary();\n\n  return (\n    \u003cdiv role=\"alert\"\u003e\n      \u003cp\u003eSomething went wrong:\u003c/p\u003e\n      \u003cpre style={{ color: \"red\" }}\u003e{error.message}\u003c/pre\u003e\n      \u003cbutton onClick={resetBoundary}\u003eTry again\u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### `withErrorBoundary` HOC\nThis package can also be used as a [higher-order component](https://legacy.reactjs.org/docs/higher-order-components.html) that accepts all of the same props as above:\n\n```js\n\"use client\";\n\nimport {withErrorBoundary} from 'react-error-boundary'\n\nconst ComponentWithErrorBoundary = withErrorBoundary(ExampleComponent, {\n  fallback: \u003cdiv\u003eSomething went wrong\u003c/div\u003e,\n  onError(error, info) {\n    // Do something with the error\n    // E.g. log to an error logging client here\n  },\n})\n\n// Can be rendered as \u003cComponentWithErrorBoundary {...props} /\u003e\n```\n\n---\n\n# FAQ\n## `ErrorBoundary` cannot be used as a JSX component\nThis 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.:\n\nIf using NPM:\n```json\n{\n  ...\n  \"overrides\": {\n    \"@types/react\": \"17.0.60\"\n  },\n  ...\n}\n```\n\nIf using Yarn:\n```json\n{\n  ...\n  \"resolutions\": {\n    \"@types/react\": \"17.0.60\"\n  },\n  ...\n}\n```\n\n---\n\n[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).\n","funding_links":["https://github.com/sponsors/bvaughn","https://opencollective.com/brianvaughn","https://buymeacoffee.com/bvaughn","https://github.com/sponsors/bvaughn/"],"categories":["TypeScript","Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvaughn%2Freact-error-boundary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbvaughn%2Freact-error-boundary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvaughn%2Freact-error-boundary/lists"}