TanStackT
TanStack2y ago
3 replies
verbal-lime

Layout component fetching useQuery and child component

Heyo, super happy that Tanstack exists, I'm still learning it.

I have a _layout route component in tanstack that uses a query to fetch data
and then for the child component I want to use the same query to use the cached data.

Do I really have to declare the queryFn in the child pages when that function is set in the layout component?
I just want to read from the cache for the child components and then have the layout component fetch the data with the useQuery.

The inspector complains about the queryFn missing in the childPages useQueries.
image.png
Was this page helpful?