Getting started
1. Install
npm
npm install @toastup/react
yarn
yarn add @toastup/react
2. Integrate
import { Toaster, toast } from "@toastup/react";
import "@toastup/react/style";
function App() {
return (
<div>
<button onClick={() => toast.add({ type: "success", title: "test" })}>
Add toast
</button>
<Toaster />
</div>
);
}
info
Although multiple Toaster components is allowed, it is recommended to have only one Toaster component in the application. If you're unsure where to place it, best place is the root of your application.