@jdthornton/toast
v1.2.8
Published
React toast context and list
Downloads
3
Readme
@jdthornton/toast
React toast context and list component.
Demo
https://jdthornton.github.io/#/toast
Install
$ npm install @jdthornton/toast
Usage
import { ToastProvider, Toaster, useAddToast } from "@jdthornton/toast";
import '@jdthornton/toast/styles.css';
function AddToastButton(){
const addToast = useAddToast();
const handleAddToastButtonClick = () => {
addToast("Here is a toast to you!")
}
return(
<button type="button" onClick={handleAddToastButtonClick}>
Add Toast
</button>
)
}
function App(){
return(
<ToastProvider>
<Toaster />
<AddToastButton />
</ToastProvider>
)
}