@ouestware/notifications
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-alpha.2 • Public • Published

Notification system fro re=act

Usage

In your Root react component, you have to add NotificationProvider:

const Root: FC = () => {
  const router = useMemo(() => getRouter(), []);

  return (
    <NotificationProvider>
      <AuthProvider>
        <ModalProvider>
          <RouterProvider router={router} />
        </ModalProvider>
      </AuthProvider>
    </NotificationProvider>
  );
};

Then in your components, you can use the hook useNotifications;

export const MyComponent: FC<unknown> = () => {
  const { notify } = useNotifications();

  return (
    <button title="Click me" onClick={()=> {
        notify({ type: 'success', title: "Hello", text: `I'm a toast example` });
    }}>
      Click me
    </button>
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i @ouestware/notifications

Weekly Downloads

8

Version

0.0.1-alpha.2

License

none

Unpacked Size

35 kB

Total Files

15

Last publish

Collaborators

  • jacomyal
  • sim51