Whats the correct way to wait for `trpc.useQuery` to finish and then update state?
Like the title said, I have a case where I need to press a button 2x to update my state.
That happens because useEffect does not wait for useQuery to be finished. Is there a way to sync those two ?
4 Replies
GitHub
should I put useQuery inside a useEffect and should I store returne...
Still wrapping my head around using this library with modern react hooks patterns. Because data fetching is considered a side effect I've seen this pattern a lot in tutorials and docs. cons...
found this post, maybe I should do it like explained here?
use the onSuccess callback of useQuery's opts
you man
are a genius
thanks