{"id":15390515,"url":"https://github.com/kossnocorp/react-guard","last_synced_at":"2025-05-07T15:46:10.828Z","repository":{"id":24324161,"uuid":"27720889","full_name":"kossnocorp/react-guard","owner":"kossnocorp","description":"🦄 React Guard automagically catches exceptions from React components, extracts useful debug information and prevents White Screen of Death 👻","archived":false,"fork":false,"pushed_at":"2022-08-30T04:15:56.000Z","size":86,"stargazers_count":96,"open_issues_count":4,"forks_count":6,"subscribers_count":46,"default_branch":"master","last_synced_at":"2025-05-01T20:01:53.787Z","etag":null,"topics":["exception-handler","exceptions","javascript","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kossnocorp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-08T15:21:44.000Z","updated_at":"2023-09-19T14:45:25.000Z","dependencies_parsed_at":"2022-07-25T09:32:03.693Z","dependency_job_id":null,"html_url":"https://github.com/kossnocorp/react-guard","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Freact-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Freact-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Freact-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kossnocorp%2Freact-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kossnocorp","download_url":"https://codeload.github.com/kossnocorp/react-guard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252908943,"owners_count":21823523,"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","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":["exception-handler","exceptions","javascript","react"],"created_at":"2024-10-01T15:06:26.822Z","updated_at":"2025-05-07T15:46:10.796Z","avatar_url":"https://github.com/kossnocorp.png","language":"JavaScript","funding_links":[],"categories":["📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"# React Guard\n\nReact Guard helps to prevent White Screen of Death,\nimproves user expirience and assists in the bug hunt.\n\nIt patches React, so it wraps every render function (including\nfunction components) intro try-catch block.\n\nIf an exception occurs during the rendering, it calls specified guard function.\nThe guard function gets the exception object and extra information such as\nthe component `props`, `state` and `displayName`.\n\n## Installation\n\n```\nnpm install react-guard --save\n```\n\nor\n\n```\nyarn add react-guard\n```\n\n## Usage\n\n```javascript\nvar React = require('react')\nvar reactGuard = require('react-guard')\n\n// Catch and process component render exceptions.\nreactGuard(React, function (err, componentInfo) {\n  // Print stacktrace to the console\n  console \u0026\u0026 console.error \u0026\u0026 console.error(err.stack)\n\n  // Notify Sentry (replace with your service of choice)\n  Raven.captureException(err, {\n    extra: {\n      props: componentInfo.props,\n      state: componentInfo.state,\n      displayName: componentInfo.displayName\n    }\n  })\n\n  // Replace failed component with \"Failed to render\".\n  // Use `return null` to render nothing.\n  return \u003cdiv\u003eFailed to render\u003c/div\u003e\n})\n```\n\n## License\n\n[MIT © Sasha Koss](https://kossnocorp.mit-license.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkossnocorp%2Freact-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkossnocorp%2Freact-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkossnocorp%2Freact-guard/lists"}