Apollo Client patterns and data loading strategies.
Use Apollo Client for:
Key patterns:
useQuery for data fetching (not useEffect + fetch)useMutation for data updatesuseQuery hooks run in parallel automaticallyApollo automatically deduplicates identical queries:
Multiple useQuery hooks run in parallel automatically:
Show the user a failure state and stop. Don't call logger.errorAndReport for an Apollo error: the shell's Apollo client reports a network or transport failure once, after any retries, and the backend has already reported an error it returned in the response. See Who reports an error. (useQuery has no onError option in Apollo 4.)
Share global event listeners across component instances:
For more detailed technical guidance, see these reference files:
On this page