0.1.0 • Published 6 months ago

use-snackbar v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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();
TypeDescription
open(string) => voidTrigger notification show, takes one argument: the message to show
0.1.0

6 months ago

0.0.1

6 months ago