Skip to content

An unopinionated `<ErrorBoundary />` React component for React 16+.

Notifications You must be signed in to change notification settings

hamlim/react-error-boundary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React-Error-Boundary 🚯

An unopinionated <ErrorBoundary /> React component for React 16+.

<div>
  <ErrorBoundary
    onError={logError}
  >
    {error => error
      ? (
        <h1>Oh no an error occurred!</h1>
      )
      : (
        <Application />
      )
    }
  </ErrorBoundary>
</div>

Props:

  • onError method called after <ErrorBoundary /> catches an error.
    • type function
    • Called with one argument, the error object thrown
  • children function called inside render
    • Called with the error object, will be null initially
    • This is the only thing returned from render, so you have full control over rendering

About

An unopinionated `<ErrorBoundary />` React component for React 16+.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published