convexAction in @convex-dev/react-query ?
How can we invoke convex actions using @convex-dev/react-query?
PS: loving convex-dev/react-query so far. Great work!
6 Replies
It looks like there's a
useConvexAction
export, I'd expect it to be used the same as a mutation, which doesn't behave any differently with react query than a standard mutation.
Someone may correct me in the morning lol, this is just what I gather looking at the code.Thanks for looking into this. This is seems to work. If someone can confirm if this is the recommended approach, that would be great. It might be worth mentioning in the docs as well.
https://docs.convex.dev/client/tanstack-query
Convex with TanStack Query | Convex Developer Hub
If you already use TanStack Query the query
@ballingt can you give a 👍 / 👎 on this
(whether this is actually the intended approach, that is)
Yes exactly! And you can also use a convex action with useQuery with convexAction.
thanks, I'll add docs for this! It's mentioned in the readme https://github.com/get-convex/convex-react-query?tab=readme-ov-file#mutations-and-actions but I need to port it over.
GitHub
GitHub - get-convex/convex-react-query
Contribute to get-convex/convex-react-query development by creating an account on GitHub.
Great. Thanks for the confirmation.