Why not just put cache variable outside react code, and have inside validUntilDate: .. data: ..
And then you can serve cache.data if validUntilDate is < Date.now(), otherwise fetch again and populate with new data & date