aizu's Knowledge Base
    • Go to: aizu.my Homepage
    • Recent
    • Tags
    • Register
    • Login

    NextJS snackbar

    Ref
    1
    1
    35
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aizu
      last edited by aizu

      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

      Ref: https://notistack.com/features/customization

      1 Reply Last reply Reply Quote 0
      • First post
        Last post