Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-hook-toast

shamouni2kMIT0.0.3TypeScript support: included

An easy toast hook built with react that you can use it outside react components.

React toast, Hook toast, Toast outside component

readme

React Toast by hooks

An easy toast hook built with react that you can use it outside react components.

Installation

 npm install react-hook-toast
import useToast from "react-hook-toast";

You need to import the css style

import "react-hook-toast/dist/style.css";

Examples

import { useEffect } from "react";
import useToast from "react-hook-toast";
import "react-hook-toast/dist/style.css";

function App() {
  const toast = useToast();

  useEffect(() => {
    toast({
      title: "hi, this is a sample",
      type: "success",
      interval: 5000,
      // type: "error"
      // type: "warrning"
    });
  }, []);

  return <div className="container"></div>;
}

export default App;