react-scoped-error-component

A Component that renders an errored component in place. Displays full error stack using redbox-react.

Usage no npm install needed!

<script type="module">
  import reactScopedErrorComponent from 'https://cdn.skypack.dev/react-scoped-error-component';
</script>

README

react-scoped-error-component

React component to display your errors in place.

This is a very simple wrapper around redbox-react. It displays the errored component in red and make the full stacktrace available on click.

When used as the error component in react-transform-catch-errors:

  • The application will continue execution and rendering.
  • The errored component will be replaced by this react-scoped-error-component.
  • The full stacktrace will be displayed using redbox-react on click.

Installation

Install using npm:

npm install react-scoped-error-component --save-dev

Usage

Catch an error and give it to react-scoped-error-component.

Works with

or manually:

const ScopedError = require('react-scoped-error-component')
try {
    render(<YourComponent />, root)
} catch (e) {
    render(<ScopedError error={e} />, root)
}

License

MIT