timolins / react-hot-toast

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

Toast call in a redux toolkit reducer error #160

Closed permmy closed 2 years ago

permmy commented 2 years ago

I'm calling toast.success in redux reducer and I'm getting this error

You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.

What could be the cause and how to resolve this?

I have added <Toaster/> at the root component

permmy commented 2 years ago

I forgot reducers should be pure functions only handling state updates