Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
Server state is a cached copy of data owned by the backend that can become stale; client state is UI data the app owns. Server-state libraries handle caching, refetching, deduplication and invalidation.
Client state includes things like whether a menu is open or what is typed in a form; the app is its only owner. Server state, such as a list of orders, lives on the server, can be changed by others, and needs loading, error, caching and refresh logic. Writing that logic by hand with useEffect and useState leads to duplicated requests, race conditions and stale views. Libraries like TanStack Query or SWR cache responses by key, deduplicate identical requests, refetch on focus or after mutations, and support optimistic updates, leaving global stores for genuine client state.