Q30: How does Normalized Caching work in Apollo Client?

Difficulty:IntermediateTopic:State Management

Apollo Client flattens nested GraphQL query responses into a flat key-value dictionary. By default, it generates a unique key for every object using its __typename and id (or _id) field (e.g., User:123). If multiple queries return data for User:123, the cache updates the single source of truth.

Key Takeaways
  • Normalized caching flattens hierarchical query results into a unified global lookup store.
Knowledge Check

What primary identifier combination does Apollo Client use by default for cache normalization?