react-error-guard
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "react-error-guard", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -27,2 +27,6 @@ # ⚛️ React Error Guard Component ⚛️ | ||
### DeveloperErrorBoundary preview | ||
![DeveloperErrorBoundary example](static/development_example.png) | ||
## `<ProductionErrorBoundary />` | ||
@@ -32,3 +36,33 @@ | ||
### Customizing `<ProductionErrorBoundary />` | ||
ProductionErrorBoundary is highly customisable through its props. | ||
**Default ProductionErrorBoundary preview (with no `dispatchErrorReporting` provided)** | ||
```jsx | ||
<ProductionErrorBoundary> | ||
{children} | ||
</ProductionErrorBoundary> | ||
``` | ||
The code above will produce the following default error message component render: | ||
![no dispatchErrorReporting preview](static/production_default_no_report.png) | ||
**Default ProductionErrorBoundary preview (with `dispatchErrorReporting` provided)** | ||
```jsx | ||
<ProductionErrorBoundary dispatchErrorReporting={dispatchErrorReporting}> | ||
{children} | ||
</ProductionErrorBoundary> | ||
``` | ||
The code above will produce the following default error message component render: | ||
![no dispatchErrorReporting preview](static/production_default_with_report.png) | ||
You can even replace the default error message by passing `errorMessageComponent` prop. | ||
```jsx | ||
const ErrorMessageComponent = ( | ||
@@ -53,3 +87,3 @@ <div className="error-message"> | ||
const MyReactContainer = ({ children }) => ( | ||
<ProductionBoundary | ||
<ProductionErrorBoundary | ||
errorMessageComponent={ErrorMessageComponent} | ||
@@ -60,8 +94,8 @@ closeIcon={<IconClose />} | ||
{children} | ||
</ProductionBoundary> | ||
</ProductionErrorBoundary> | ||
) | ||
``` | ||
The example above uses [`raven-js`](https://github.com/getsentry/raven-js) but any reporting tool can be used. | ||
▶️ The example above uses [`raven-js`](https://github.com/getsentry/raven-js) but any reporting tool can be used. | ||
🌟 This project started, and still is, an abstraction taken from the amazing works of the [`create-react-app`](https://github.com/facebook/create-react-app/) team. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87519
98