Skip to main content

Recovering Errors

Import the ErrorBoundary component:

import ErrorBoundary from 'react-native-error-boundary'

Then, wrap it around any component that could throw an error:

const App = () => (
<ErrorBoundary>
<ChildrenThatCouldThrowEror />
</ErrorBoundary>
)

If any of the children of the ErrorBoundary throws an error, a fallback screen will be rendered, to communicate the user that an error happened.

Demo