P
P
pixal2019-05-29 18:37:04
React Native
pixal, 2019-05-29 18:37:04

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

3 answer(s)
S
Sergey Panteleev, 2019-05-30
@s_panteleev

You can use the regular Cache Control (iOS Only)
Or third-party libraries, for example, react-native-cached-image

R
Roman Alexandrovich, 2019-05-30
@RomReed

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.

Z
zlends, 2019-06-01
@zlends

For caching images react-native-fast-image
For caching redux-persist
- so that there are no problems, configure either wifteList or blackList

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question