useEffect and useMutation error about conditional rendering of hooks
I am using t3 stack with tRPC, and I am trying to mark all emails as seen when the page loads by using useEffect, but this seems to give me an error about conditional rendering of hooks.
Are there any other ways I can accomplish this?
6 Replies
You probably have an if statement before usage of some hook
No, it reports the error at this code:
markAsSeen({ sentTo: paPlayer!.id });
I believe it is because I am calling a hook inside another hook
@alex / KATTtry upgrading to 10.27.2
For me calling the useQuery hook in useEffect is not possible i get an error instantly
can any of you make a reproduction? hard to help when i'm guessing the context
I gave up and ended up using a button instead, it solved my issue
Seems like calling a hook inside another hook is what causes it