Exercise 2: Why version Is Just a Number — Possible Solution ==================================================================== WHY A PLAIN NUMBER, NOT THE ITEMS ARRAY ------------------------------ If ItemsContext held the actual item data, every feature that needs items - alerts, search, recipes - would either have to read from that one shared copy (forcing them to share the exact same shape and filtering logic) or the Context would need to somehow hold several different views of the same underlying data at once. Neither is what this app actually needs. What every feature genuinely needs is just to know "something changed, go refetch your own view" - and a plain incrementing number is enough to express that: each consumer's own useEffect depends on version, so any change to it triggers a refetch, regardless of what the new value actually is. WHAT THIS CONTEXT IS AND ISN'T RESPONSIBLE FOR ------------------------------ It is responsible for coordination - broadcasting "a mutation just happened" to anything that cares. It is explicitly not responsible for storage or caching - it never holds item data itself, and every hook (useExpiryAlerts, the search hook, RecipeSuggestions) still owns its own fetch call to its own Express route, gets back exactly the shape it needs, and manages its own loading state independently. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains why a single number is sufficient to express "a change happened" without needing to represent what changed, and it correctly draws the line between what this Context does (signal coordination) and what it deliberately avoids doing (owning or caching actual data), rather than describing version as an arbitrary implementation detail.