liveBook · Manning

Remote data

As explained in React Hooks in Action: With Suspense and Concurrent Mode

Server state is application data whose authoritative value is maintained by a remote server and synchronized to clients.

Remote data is application data whose authoritative value lives on a server. In a bookings app, bookables, bookings, and users may be requested repeatedly as users move between pages. Without coordination, each page waits for data that another page already loaded. section 10.3.1 section 10.3

React Query treats remote data as server state and coordinates its client-side lifecycle:

  • Cache previously fetched results so navigation can reuse them. section 10.3.1
  • Deduplicate simultaneous requests for the same data. section 10.3.1
  • Refetch stale data in the background while exposing loading, status, and error information. section 10.3.1 section 10.3
  • Update server state through mutations and coordinate the query cache afterward. section 10.3

A smoother bookings workflow

With a delayed json-server response, the Bookables page initially shows a loading indicator. After the bookables load, navigating to Bookings can reuse cached data instead of reloading it, while background fetching obtains newer results. section 10.3.1

  const {data, status, error} = useQuery(key, () => fetch(url));

A useQuery listing shows the compact connection between a query key, fetch function, returned data, status, and error state. section 10.4

How React Hooks in Action: With Suspense and Concurrent Mode covers it

How deep it goes
Explains caching, background refetching, query status, mutations, and query-cache access without descending into networking internals.
Examples
Uses a bookings app, delayed json-server responses, Bookables navigation, loading indicators, and repeated users or bookables requests.
What it assumes
Assumes React application work and an existing fetch-based hook, while introducing React Query’s client, provider, and query hooks.
What you can do after
Operate/configure React Query to fetch, cache, refetch, and mutate server data while exposing request status.
How it connects
Connects server state with caching, background fetching, request deduplication, mutations, and query caches.

Also explained in

Compare how 2 books explain remote data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of React Hooks in Action: With Suspense and Concurrent Mode. The section links point to the parts of the book it draws on.