ReactInterview preparation
Intermediate·Concept·2 min read

Local state vs Redux/Zustand vs server state?

Practice this question

Definition:

Local state belongs to a nearby component, a client store coordinates shared UI data, and server state represents data owned by a remote service. Server-state tools manage freshness, fetching and invalidation because the browser is only keeping a cached copy. Choosing the owner first prevents duplicated and conflicting sources of truth.

Key points:

  • Keep small UI state close to the component that uses it.

  • Use a shared store when many features need coordinated client state.

  • A server-state library such as TanStack Query handles fetching, caching and invalidation.

  • Query keys should include the variables that distinguish results, such as tenant, filters and page cursor.

Interview point:

  • A shared store is not automatically the best place to manually reproduce request caching, retry and invalidation behavior.
Adapted from 06_REACT_NEXTJS.md · “Local state vs Redux/Zustand vs server state?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.