Pass initial data in a server component
Hi. I'd like to achive something like this using nextjs app router and tanstack query:
1. Root layout renders and fetches initial user vip level by session id from cookies
2. Root layout renders a
3. Client component somewhere else uses hook
How can I pass this initial data to query client and then make some type assertions inside
1. Root layout renders and fetches initial user vip level by session id from cookies
2. Root layout renders a
QueryClientProvider and passes just fetched level - lets say bronze to the provider3. Client component somewhere else uses hook
useVipLevel which should never be loading because there should be initial data passed on the first user enter even before client components renderHow can I pass this initial data to query client and then make some type assertions inside
useVipLevel to tell the useQuery that we always have data?