DEV Community

Discussion on: Avoiding Race Conditions when Fetching Data with React Hooks

Collapse
nas5w profile image
Nick Scialli (he/him) Author • Edited

It sounds like this concern would be more appropriately managed through cache headers from the backend. In this implementation, it seems the frontend is deciding that the initial data fetch is good for as long as the app is open.

Collapse
talha131 profile image
Talha Mansoor

it seems the frontend is deciding that the initial data fetch is good for as long as the app is open.

It is a perfect point.

If we ignore it for a moment please, then my question is, is it possible to leverage useMemo hook for caching data in the example? How will that work?