Thank you to @happydev on the Astro discord who was able to figure this out.
1. Install react-hot-toast
2. Create a component called Toastify.tsx
The Toastify
component takes another component as its argument and
returns it with a Toaster
component imported from react-hot-toast
.
3. Create a component called Button.tsx
4. Import Toastify.tsx into Button.tsx
Export the Toastify
component with the Button
as its argument.
5. Create a function to trigger the toast
6. Set the client directive to client:load
If there is no client directive the HTML will be rendered without JavaScript. Reference