iamhosseindhv / notistack

Highly customizable notification snackbars (toasts) that can be stacked on top of each other
https://notistack.com
Other
3.94k stars 298 forks source link

NextJS + Snackbars #604

Closed BLazzeD21 closed 5 months ago

BLazzeD21 commented 5 months ago

Is there any example of using Notistack in NextJS application?

import { SnackbarProvider } from "notistack";

import ResponsiveSnackbar from "@/widgets/Snackbar/Snackbar";

export default function NotistackProvider({
    children,
}: Readonly<{
    children: React.ReactNode;
}>): JSX.Element {
    return (
        <SnackbarProvider
            Components={{
                success: ResponsiveSnackbar,
                error: ResponsiveSnackbar,
            }}
        >
            {children}
        </SnackbarProvider>
    );
}

Where is it better to use this provider, but not lose the SSR and CEO, so that the entire application has access to this context?

Thanks in advance for your answer ^_^