Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, I'm using React useQuery (technically tRPC client which built a wrapper around it) and I'm hoping to refetch data whenever a page is re-loaded after navigating back to it. Currently when I first load a page useQuery will make the data requests, and then if I navigate back and land on the previous page, because useQuery already made these requests and the state is maintained in the stack (I presume, I don't know how it works) then useQuery doesn't make a new request. This is fine and dandy except I want to refetch data when I go back to a page like I used to when I used React Navigation.
Currently I'm using
usePathname()
in _layout.tsx to accomplish this, but I'm wondering if there is a cleaner way that anyone has devised. Here's a minimal copy of my code:hooks.ts
_layout.tsx
foods.tsx (the page)
Beta Was this translation helpful? Give feedback.
All reactions