How to implement a callback/action when the query is successful?
Hi there previously I did something like this
but onSuccess and onError have been deprecated, what do I need to use in the v5 api to arrive at the same functionality?
Thanks
4 Replies
foreign-sapphire•2y ago
please don't sync state - you can just use
data
returned from useQuery
stormy-goldOP•2y ago
hey @TkDodo 🔮 what if I would like to set that data returned from the query on my context? or is this a no no?
foreign-sapphire•2y ago
yeah why would you? Except:
https://tkdodo.eu/blog/react-query-and-react-context
React Query and React Context
Can it make sense to combine React Query with React Context ? Yes, sometimes ...
stormy-goldOP•2y ago
aah thanks very much 🙏