State Management · Senior · Question 25 of 75
Why must you not create one global QueryClient for all requests on the server?
- ✓Correct answer: Data of one user could be served to another from the shared cache
- 2A global client doesn't support async functions
- 3Next.js forbids module-level variables
Explanation
Server processes handle many users. Create the client per request (e.g. React cache() in RSC). In the browser, by contrast, one client for the whole app is correct.