timolins / react-hot-toast

Smoking Hot React Notifications 🔥
https://react-hot-toast.com
MIT License
9.55k stars 313 forks source link

feat: `toast.promise(async () => {})` #301

Open kagurazaka-0 opened 11 months ago

kagurazaka-0 commented 11 months ago

I wanted to use multiple awaits in toast.promote, but that was an error. I implemented it so that it can be done.

toast.promise(
  async () => {
    await fetch();
    await fetch();
    await fetch();
  },
  {
    loading: 'Loading',
    success: 'Got the data',
    error: 'Error when fetching',
  }
);
vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hot-toast ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 12, 2023 7:40am
SidouGmr7 commented 4 months ago

u can use async function with await for each