TanStackT
TanStack2y ago
9 replies
excited-coffee

Getting a promise from useQuery

I have a button which navigates to some screen when clicked, but this navigation requires some initial data which has defaults stored in user settings. I am fetching user settings with useQuery. Instead of disabling my button until the settings have been loaded, I would rather be able to get a promise from useQuery somehow so that I can await this on-click (given that settings haven't loaded by the time the user clicks). I know I can just refetch, but that would be a bit slower.

Is there any way to do this natively? Thanks
Was this page helpful?