react-error-notify
v1.1.8
Published
React Error Notify is a versatile package for catching and logging errors at both component and API levels within your React applications. It seamlessly integrates with various error reporting services, such as Slack, allowing you to monitor and debug err
Downloads
10
Maintainers
Readme
react-error-notify
react-error-notify is a React-Native and React error boundary component that helps catch and notify about component-level errors in your React applications. It integrates with Slack to send notifications about errors.
Installation
You can install react-error-notify via npm:
npm install react-error-notify
Usage
Wrap your application or any specific part of your UI where you want to catch errors with the <REN>
component:
import React from 'react';
import { REN } from 'react-error-notify';
function App() {
return (
<REN>
{/* Your application components */}
</REN>
);
}
export default App;
Props
children
ReactNode - The child components to be wrapped by the
<REN>
component.
fallbackComponent
ReactNode (optional) - Custom fallback UI to be rendered when an error occurs.
sendToSlack
Boolean (recommended) - Flag to enable/disable sending error notifications to Slack.
slackConfig
{ url: string } (required if
sendToSlack
is enabled) - Configuration object containing the Slack webhook URL. Follow this documentation to create a slack app if you do not have a slack url: https://api.slack.com/messaging/webhooks
Example
import React from 'react';
import { REN } from 'react-error-notify';
function App() {
return (
<REN fallbackComponent={<MyFallbackComponent />} sendToSlack slackConfig={{ url: 'your-slack-webhook-url' }}>
{/* Your application components */}
</REN>
);
}
export default App;
License This project is licensed under the MIT License - see the LICENSE file for details.