Exercise 3: Why useExpiryAlerts Exposes Its Own refresh Function — Possible Solution ==================================================================== WHAT A FETCH-ONLY-ON-MOUNT VERSION WOULD MISS ------------------------------ If the hook only fetched once inside its own internal useEffect with no way to trigger it again, the alerts list would only ever update when the ExpiryDashboard component itself first mounts - any change to the underlying data after that point would have no way to reach the already-rendered list. WHY THAT MATTERS FOR THIS SPECIFIC APP ------------------------------ Chapter 9's own mark-used action changes an item's status away from 'active', which should immediately remove that item from the alerts list, since it's no longer something the user needs to act on. Without a way to re-trigger the fetch after that action completes, the alerts dashboard would keep showing an already-used item until the user happened to reload the whole page - a stale, confusing experience for something the user just explicitly handled. WHY EXPOSING refresh SOLVES THIS ------------------------------ By returning refresh alongside alerts and loading, any other part of the app - specifically, whatever calls the mark-used action - can call refresh() immediately after that action succeeds, causing the alerts list to update right away without needing a full page reload or any other workaround. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly identifies that a fetch-only-on-mount hook would leave the alerts list stale after Chapter 9's mark-used action changes the underlying data, and correctly explains that exposing refresh lets that other part of the app trigger an immediate update instead.