Answer the question
In order to leave comments, you need to log in
How to implement caching in React Native?
Hello! I need to save the data (including images) received from the server locally and, in the absence of the Internet, take these local data for output. Can you please tell me how to implement this?
As I understand it, you need a SQLite database, but what about images? It is unreasonable to keep them in the database on the server.
Answer the question
In order to leave comments, you need to log in
You can use the regular Cache Control (iOS Only)
Or third-party libraries, for example, react-native-cached-image
Caching is a sore subject! Your version with SQLite is very good! We used https://github.com/rt2zz/redux-persist but it didn't perform well! I had to manually put the necessary data on the keys in asyncstore and, if necessary, synchronize with the server.
As for images, you need to understand that keeping pictures in the phone's memory all the time is a bad idea! react-native-cached-image was used and it worked, but not on a lot of images.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question