Skip to content
Discussion options

You must be logged in to vote

It looks like you want your toast notification to appear automatically when the component is rendered. However, the addToast function 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

  1. Ensure addToast is Imported Correctly

    • If addToast is coming from @heroui/react, make sure it's a function that can be called inside useEffect. Some libraries require it to be accessed via context.
    • Try logging inside useEffect to see if it runs when the component is mounted:
      useEffect(() => {
          console.log("Toast effect running");
          addToast({
              title,
              description,
              color: type,
              timeout

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by vmorales-2920
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants