NextJS snackbar
-
npm install notistack
_app.js
import { SnackbarProvider } from 'notistack' <SnackbarProvider> <Component {...pageProps} /> </SnackbarProvider>
component.js
import { useSnackbar } from 'notistack' export default function Page() { const { enqueueSnackbar, closeSnackbar } = useSnackbar() ... enqueueSnackbar('Please select answer.', { variant: 'error' }) }
default, success, error, warning and info