burgos-snackbar
v2.1.0
Published
#### A hook, context and component for rendering @mui/material snackbar globally
Downloads
133
Readme
Snackbar
A hook, context and component for rendering @mui/material snackbar globally
Preparation
wrap your app with <SnackbarProvider>
and place the <Snackbar />
component:
<SnackbarProvider>
<App />
<Snackbar />
<SnackbarProvider/>
Usage
Use the useSnackbar hook to retrieve the method and call it passing the severity and text as an object:
import { useSnackbar } from 'burgos-snackbar'
export const App = () => {
const { snackbar } = useSnackbar()
const handleClick = () => {
snackbar({severity: 'success', text: 'Click successful'})
}
}