Skip to main content

Installation

Requirements​

  • React version >= 18 or above

Installation​

npm i --save react-toastify

The gist​

import { ToastContainer, toast } from 'react-toastify';

export default function App() {
const notify = () => toast('Wow so easy !');

return (
<div className="grid place-items-center h-dvh bg-zinc-900/15">
<Button onClick={notify}>Notify !</Button>
<ToastContainer />
</div>
);
}
Important

Remember to render the ToastContainer once in your application tree. If you can't figure out where to put it, rendering it in the application root would be the best bet.