0

My homepage takes a second to load some images I'm pulling from an API. When I navigate away from my homepage and then back to it again the images take a second to load again.

How can I persist components I navigate away from so that they only have to load once?

wvicioso
  • 538
  • 1
  • 3
  • 13
  • I don't mind a little loading, but in case of an API it can be problematic. Take a look at [prefetching](https://facebook.github.io/react-native/docs/image.html#prefetch) for the react-native image component, maybe it can help? – DerpyNerd Jun 16 '17 at 13:16

1 Answers1

3

React Native's built in Image component does not cache images, unfortunately.

Use Image component with built in caching mechanism. Here is such component

Andreyco
  • 22,476
  • 5
  • 61
  • 65