React · Senior · Question 37 of 75

Why can't you use a single global QueryClient for all requests on the server?

Explanation

The server handles requests from different users in one process, and a shared cache would mix their data. Create a client per request (e.g. via React's cache() in RSC). In the browser, on the contrary, there's one client for the whole app.

Further reading

Problem with a question

React · Senior · question 37

Test yourself

Take the React · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz