react-error-notify
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

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.

/react-error-notify/

    Package Sidebar

    Install

    npm i react-error-notify

    Weekly Downloads

    18

    Version

    1.1.8

    License

    ISC

    Unpacked Size

    11.6 kB

    Total Files

    8

    Last publish

    Collaborators

    • mustymustafa10