react-snackbar-messages

1.0.2 • Public • Published

React Snackbar Messages

Getting Started

Installation

npm install --save react-snackbar-messages

or

yarn add react-snackbar-messages

Usage

Wrap your application within a SnackbarProvider.

import { SnackbarProvider, useSnackbar } from 'react-snackbar-messages'
 
const ChildComponent = () => {
  const snackbar = useSnackbar()
 
  const showSnackbar = () => {
    snackbar.add('Hello Snackbar!', {
      appearance: 'sucess',
      autoDismiss: true
    })
  }
 
  return <button onClick={showSnackbar}>Show Snackbar</button>
}
 
const App = () => (
  <SnackbarProvider>
    <ChildComponent />
  </SnackbarProvider>
)

Package Sidebar

Install

npm i react-snackbar-messages

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

41.1 kB

Total Files

11

Last publish

Collaborators

  • mohamedsamara