Corbi-Wan KenobiC
Convex Community12mo ago
5 replies
Corbi-Wan Kenobi

How to query while inside a function?

I have a handleSubmit function called by a form. I have a query built that works, but I don’t know how to access it while I’m inside of a function. I know the query works because I can hardcode and use a stand alone useQuery but I can’t figure out the syntax/command to use while inside of a function to call it with an arg. I’m using TanStack.

Clarification: the query does a check for some business logic which is why I’m doing it inside of the handleSubmit. The rest of the handleSubmit depends on the result of this initial query.

Do I need to do this more sequentially instead of all inside one function? Get the form element I need and make it a const then pass that to a query, then call that from inside the handle form?
Was this page helpful?