react-error-boundaries
Advanced tools
Comparing version
{ | ||
"name": "react-error-boundaries", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "React HOC for error boundaries.", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/Chyrain/react-error-boundary.git" | ||
"url": "git+https://github.com/Chyrain/react-error-boundaries.git" | ||
}, | ||
@@ -23,5 +23,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/Chyrain/react-error-boundary/issues" | ||
"url": "https://github.com/Chyrain/react-error-boundaries/issues" | ||
}, | ||
"homepage": "https://github.com/Chyrain/react-error-boundary#readme", | ||
"homepage": "https://github.com/Chyrain/react-error-boundaries#readme", | ||
"license": "MIT", | ||
@@ -28,0 +28,0 @@ "dependencies": { |
@@ -54,6 +54,7 @@ # react-error-boundaries | ||
// import first | ||
import React from 'react' | ||
import { errorHandlerDecorator } from 'react-error-boundaries' | ||
@errorHandlerDecorator | ||
export default class FilterableProductTable extends React.PureComponent { | ||
export default class YourComponent extends React.Component { | ||
constructor(props) { | ||
@@ -73,3 +74,3 @@ super(props); | ||
Define your errorCallback function and FallbackComponent: | ||
By using it as a HOC. You can also customize the errorCallback function and FallbackComponent for better appearance: | ||
@@ -80,7 +81,20 @@ ```js | ||
const yourErrorHandler = withErrorHandler( | ||
const ComponentWithErrorBoundary = withErrorHandler( | ||
errorCallback, // report Error to service | ||
FallbackComponent // Component to display errors | ||
FallbackComponent, // Component to display errors | ||
YourComponent // Component to decorate | ||
) | ||
// or customize as a ES7 decorator | ||
const yourErrorHandlerDecorator = withErrorHandler( | ||
errorCallback, // report Error to service | ||
FallbackComponent, // Component to display errors | ||
) | ||
@yourErrorHandlerDecorator | ||
class YourComponent extends React.component { | ||
//...... | ||
} | ||
``` | ||
@@ -90,3 +104,3 @@ | ||
Input 'i' in search input and error will throw. | ||
Input `i` in search input and error will throw. | ||
@@ -93,0 +107,0 @@ ```shell |
19610
2.13%111
14.43%