Skip to main content

Server State for Reacts

Server state is data that lives on a backend and is only borrowed by the UI, so it can be stale, loading or failed. Libraries like TanStack Query fetch it, cache it by key, refetch it and handle mutations, which is cleaner than hand-written useEffect and useState combinations.

Stage: Data and Routing · Part of the React roadmap · Last reviewed 19 November 2026

What to learn in Server State

Server State interview questions

Why is fetching inside useEffect with useState error-prone?

You must handle loading, errors, cancellation, race conditions between requests and caching yourself. Without that, stale responses can overwrite newer ones and the same data is refetched repeatedly. Query libraries solve these cases consistently.

What is an optimistic update?

It updates the UI immediately as if a mutation succeeded, then confirms or rolls back when the server responds. It makes interactions feel instant, but needs rollback logic and a refetch so the screen matches the real data.

Where Server State fits in the React roadmap

Server State belongs to the Data and Routing stage (intermediate level), which takes about 25 hours. Connect to the world.

Back to the full React roadmap