Do I need to preload JSON data in Expo


#1

Hi
Does having assets in your app mean your app will rely on internet connection when you build and deploy with expo?
My app is using JSON data, and images, and I don’t want users to need internet connection to use it, but after releasing it doesn’t load up without internet connection and sometimes even crashes. I am using es6 imports to read the JSON in assets and set Redux state.


#2

Hi, we don’t support first-load-offline for assets right now (though we are working on it), but you can cache assets after the first load and they’ll be available offline in subsequent loads.

https://docs.expo.io/versions/latest/guides/preloading-and-caching-assets.html#content


#3

Thanks @ben.

Does same thing happen with JSON? Is it advisable to place in the assets folder as well? I didn’t see anything specific to it in the docs.


#4

I think what you can do is to export your json like this.
const json = {...}
export default json

Now you can import this as import json from './json.js'