timolins / react-hot-toast

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

Element type Error when using with nextjs and redux-toolkit #333

Open mohammad-reza-tajik opened 9 months ago

mohammad-reza-tajik commented 9 months ago

hi. i'm using nextjs with redux-toolkit . i have a userAction.ts file that in it user adds an item to its cart and then receives a success notification and in that file i use toast object like this :

import toast from "react-hot-toast";

 dispatch(userActions.addToCart(productId));
 toast.success("added to your cart successfully")

and get this error :

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

parthusun8 commented 3 months ago

Hey @mohammad-reza-tajik

I am having the same problem Were you able to solve the error?