Issue with usequery hooks (rendered more hooks than previous error)
Reference the attached screenshot for the error and the code.
2 Replies
Hooks can't run conditionally - the same hooks have to run in the same order on every render or you'll get that kind of error. You'll want to pass
skip
instead of an args object to useQuery()
to avoid running the query before you have a userId.
Docs here: https://docs.convex.dev/client/react#skipping-queries
thank you!