@times-components/error-view
v2.6.42
Published
Handles errors
Downloads
27,100
Readme
Error View
The error view package is a React Error Boundary. From the React documentation itself:
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.
This package provides an ErrorView
wrapper component that takes a render prop
as a direct child of the component. This function returns three possible values
which can be used to handle the enclosed child components:
error
- the error that was returnedhasError
- boolean, did the component erroronError
- a function that handles errors and triggers the error view components error handling
Contributing
Please read CONTRIBUTING.md before contributing to this package
Running the code
Please see our main README.md to get the project running locally
Development
The code can be formatted and linted in accordance with the agreed standards.
yarn fmt
yarn lint
Testing
This package uses yarn (latest) to run unit tests on each platform with jest.
yarn test:web
Visit the official storybook to see our available error view templates.