What is the best way to cache data on reactjs

I have created a website that uses a large amount of data from the server, it slows down the display of data, I want to know what is the best way to save the data in the cache for reactjs and update it only if there is a change in data base thanks


There are lot of strategies that you can use to cache data:

  • Use a library like React Query or Relay that automatically caches data
  • Use a library like redux-persist along with redux to cache data.

Alternatively, if performance is impacted because you are showing a big list of data, you should use some virtualisation on the client like react-virtualised.