Package Exports
- react-error-isolation
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-error-isolation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-error-isolation (WIP)
About
Don't let one error destroy the whole project
Similar Projects / Alternatives / Idea
How to Install
First, install the library in your project by npm:
$ npm install react-error-isolation
Or Yarn:
$ yarn add react-error-isolation
Getting Started
With Context configuration
• Import context provider and HOC in React application file:
import {
ErrorIsolationProvider,
withErrorIsolation,
} from 'react-error-isolation';
• Set ErrorIsolationProvider (if you want to use the same error screen for all components wrapped in withErrorIsolation HOC):
// index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { ErrorIsolationProvider } from 'react-error-isolation';
import App from './App';
const ErrorScreen = () => {
return (
<div>
<h1>Oops!</h1>
<h2>Something went wrong.</h2>
</div>
);
};
ReactDOM.render(
<ErrorIsolationProvider errorScreen={<ErrorScreen />}>
<App />
</ErrorIsolationProvider>,
document.getElementById('root')
);
• Then use withErrorIsolation:
// App.js
import React from 'react';
import { withSuspense } from 'react-suspenser';
const App = () => {
return (
<div>
<p>Hello World!</p>
</div>
);
};
export default withErrorIsolation()(App);
License
This project is licensed under the MIT License © 2020-present Jakub Biesiada