use-snackbar
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

use-snackbar

Installation

npm i use-snackbar

Examples

You can use the component without any props, which just will result in rendering an uncontrolled component

import { SnackbarProvider, useSnackbar } from "use-snackbar";

function App() {
  return (
    <SnackbarProvider>
      <SomeComponent />
    </SnackbarProvider>
  );
}

function SomeComponent() {
  const [open] = useSnackbar();

  return (
    <>
      {/* other elements */}
      <button onClick={() => open("triggered!")}>open</button>
    </>
  );
}

for the full documentation, check documentation section

Documentation

useSnackbar

const [open] = useSnackbar();
Type Description
open (string) => void Trigger notification show, takes one argument: the message to show

Package Sidebar

Install

npm i use-snackbar

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

12.3 kB

Total Files

22

Last publish

Collaborators

  • waddah-jd