timolins / react-hot-toast

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

HTML url to inject for standalone components? #198

Closed marksark closed 2 years ago

marksark commented 2 years ago

Hi! I'm trying to find the HTML url to inject in my index.html so that React-Hot-Toast is available to all my components (as opposed to importing it in each component).

Where can I find the url? I currently am using angularJS but inject individual react components.

Again, my goal is to avoid importing {Toaster} into each component and just doing it once and do it everywhere.

timolins commented 2 years ago

I'm not sure if I understand. You don't have to import {Toaster} in each component, just once in your container (this is where all toasts will be placed). Then, you can import {toast} to dispatch new toasts.

marksark commented 2 years ago

Thanks for following up, I ended up figuring this out. The issue was how to inject the singular Toaster in HTML (app rendered in Angular JS, but we inject React components individually in angular JS html files).

We ended up wrapping in a standalone react component and injecting it into our index.html using ng-react.