I have a couple of JSON files used for animation (used in lottie-react-native) in my react native app. Each file is around 100KB and the total size of all JSON files amounts to 2-3MB. Now my goal is to get rid of this 2-3MB as much as possible. So, should I go for cloud storage of these JSON files, or should compress and store them and then later decompress at the time of use? If I should go with the compress/decompress approach, then please suggest the library as well which would perfectly satisfy my requirement.
Juan Pablo Isaza
You can use jsonc https://www.npmjs.com/package/jsonc to compress the json files and store them
Well, you can use Cache Storage for this purpose. (Please check ServiceWorker support on browsers. https://caniuse.com/serviceworkers). It will allow you to load the content once, and cache it in user browser. It is working with ServiceWorker technology, which requires an small implementation.
https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage
Or you can implement google's workbox library, which allows you to do same thing in a cleaner way.
https://developers.google.com/web/tools/workbox/guides/get-started#routing_and_caching_strategies
I can't suggest to put all of your json content to localStorage. It's working memory based. It might have performance problems in low memory/cpu computers.