react-headless-notifications
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

react-headless-notifications

Bring-your-own-UI react notification system

NPM JavaScript Style Guide

Install

npm install --save react-headless-notifications

Usage

In your App.tsx:

import React from 'react'
 
import { NotificationProvider } from 'react-headless-notifications'
 
const App = () => {
  return (
    <NotificationProvider>
      <MyStuff />
    </NotificationProvider>
  )
}
 
export default App

In your MyStuff.tsx:

import React from 'react'
import { useNotifications } from 'react-headless-notifications'
 
const MyStuff = () => {
  const { addNotification } = useNotifications()
  return (
    <>
      <button onClick={() => addNotification('this is an error', { type: 'error'})}>Show error</button>
    </>
  )
}
 
export default MyStuff

For a full running CRA example, see the example directory.

License

MIT © jens-ox

/react-headless-notifications/

    Package Sidebar

    Install

    npm i react-headless-notifications

    Weekly Downloads

    3

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    51.4 kB

    Total Files

    23

    Last publish

    Collaborators

    • jens-ox