TanStackT
TanStack16mo ago
9 replies
incredible-moccasin

Pattern for data fetching

Which pattern is better in the following case (react query plus next js)
A page where multiple child and grand child are dependent on some data from an api let's say user info api
Let say some component uses name, someuses contact and some use other things
Soo
1. I make the request at the top of the page
Store data in zustand (any state management library) and my components just use that or I pass down data, but here I make my page 'use client'
2. Each component makes same request with same key ('user-data')
Was this page helpful?