Interview frequency: …
Short answer
Server State is externally owned and asynchronous, requiring caching and synchronization; Client State is local, synchronous, and owned by the browser. Putting both in Redux creates unnecessary complexity.
Explanation
Server data needs caching, Background Revalidation, loading and error states, which specialized libraries such as TanStack Query (React Query) and SWR handle well. Client State (such as open dialogs, theme, or form drafts) suits lightweight libraries such as Zustand or Context.
Code example
// Separate management of both states
// 1. Server State By TanStack Query:
const { data: user, isLoading } = useQuery({ queryKey: ['user', id], queryFn: fetchUser });
// 2. Client UI State By Zustand:
const isSidebarOpen = useUIStore(state => state.isSidebarOpen);Common mistakes
- Manually storing every API response in the Redux store and writing hundreds of repetitive actions and reducers.
Follow-up questions
- What is Zustand, and why is it popular as a lightweight, fast alternative to Redux?
- What is Atomic State in libraries such as Jotai (and archived Recoil), and how does it compare with Redux's Single Store pattern?