timolins / react-hot-toast

Smoking Hot React Notifications 🔥
https://react-hot-toast.com
MIT License
9.66k stars 319 forks source link

<Toaster /> component in higher order component or layout file #240

Open ilhamgum opened 1 year ago

ilhamgum commented 1 year ago

Hello, i wanna achieve placing only 1 line in my layout file, is it possible? Because for now i must put component in each file that want to use toast() to be functional.

Expected:

<main
    className={`${hideTopNavbar ? "mb-[80px]" : "mt-[45px] mb-[80px]"}`}
>
    <Toaster>
        {children}
    </Toaster>
</main>
joshfom commented 1 year ago

This works for me

<main
    className={`${hideTopNavbar ? "mb-[80px]" : "mt-[45px] mb-[80px]"}`}
>
    <Toaster />

        {children}

</main>