Toast component being called without pressing button #4953
|
Hi all, I need to create a component where it executes the Toast component the moment the component is called toast.tx ` ` Just for information, I'm using NextJS 14 and I have also added the ToastProvider in the HeroUIProvider Thanks |
Replies: 2 comments
|
It looks like you want your toast notification to appear automatically when the component is rendered. However, the Possible Issues & Fixes
|
|
@Aman3899 Solution was helpful! |
It looks like you want your toast notification to appear automatically when the component is rendered. However, the
addToastfunction might not be triggering correctly due to how HeroUI's toast system works. Here are a few things to check and improve:Possible Issues & Fixes
Ensure
addToastis Imported CorrectlyaddToastis coming from@heroui/react, make sure it's a function that can be called insideuseEffect. Some libraries require it to be accessed via context.useEffectto see if it runs when the component is mounted: