Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-error-guard

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-error-guard - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc