@cabezonidas/react-toast
v1.12.2
Published
Headless toaster for React
Downloads
19
Maintainers
Readme
react-toast
Headless toaster for React apps
Toasts Provider for React apps
import React from "react";
import ReactDOM from "react-dom/client";
// Include stylesheet in your application
import "@cabezonidas/react-toast/index.css";
const rootElement = document.getElementById("root")!;
const root = ReactDOM.createRoot(rootElement);
// Include the toast provider
root.render(
<React.StrictMode>
<ToastProvider>
<App />
</ToastProvider>
</React.StrictMode>
);
const App = () => {
const { toast } = useToast();
return (
<div className="App">
<button
type="button"
onClick={() => toast('Some text')}
>
Toast
</button>
</Splitterdiv>
)
}