lordkeebler
lordkeebler12mo ago

non-hook queries in React

Hi is there away for us to use a non-react query in a util function in a react project?
5 Replies
ballingt
ballingt12mo ago
If you've got your https://docs.convex.dev/api/classes/react.ConvexReactClient instance you can call methods on it directly instead of using hooks
ballingt
ballingt12mo ago
or use useConvex to get the client from up the tree and use that in callbacks
lordkeebler
lordkeeblerOP12mo ago
Think I got it Do you have ar eference for managing loading with convex?
ballingt
ballingt12mo ago
The useQuery hook returns undefined while the convex query is loading. and client.query(api.foo.bar, {}) return a promise which resolves with the query value
lordkeebler
lordkeeblerOP12mo ago
God thank you so much, I love convex just switched over today from supabase and am building out an enterprise application with it

Did you find this page helpful?