🧈 Toast
Use react-hot-toast to trigger animated toast messages
Install Hot Toast
command line
npm i react-hot-toast
Check out the official docs.
Declare the Toaster
import Navbar from '../components/Navbar';
import { Toaster } from 'react-hot-toast';
function MyApp({ Component, pageProps }) {
return (
<>
<Navbar />
<Component {...pageProps} />
<Toaster />
</>
);
}
Trigger a Toast Message
import toast from 'react-hot-toast';
export default function Home() {
return (
<div>
<button onClick={() => toast.success('hello toast!')}>
Toast Me
</button>
</div>
);
}