How to cache ReactJS fetch json results for a period of time in localStorage

Dimitris Moutsatsos
2 min readApr 21, 2021

In a ReactJS app i was calling an external API to get some news and display to the user. Every time this page was loading i had this external API call.

So i need to make a small 5 minute caching of the result in order to avoid external calls.

--

--

Dimitris Moutsatsos

developer and weirdo / current: Tychetech / MAD TV / WARR