Add Read-Only Offline Support Using the Offline Exchange from urql GraphCache

Share this video with your friends

Send Tweet

We'll install the Async Storage and the React Native-compatible offline storage for graphcache, and configure the news app to show cached data when offline. You'll be able to set how long data is cached for offline viewing.

Resources:

  • GraphCache offline: https://formidable.com/open-source/urql/docs/graphcache/offline/
  • React Native offline storage for Graphcache: https://github.com/FormidableLabs/urql/tree/main/packages/storage-rn
  • Async Storage: https://react-native-async-storage.github.io/async-storage/docs/install/

Expo:

  • Install Async Storage using the expo cli: expo install @react-native-async-storage/async-storage

Checkpoint: Show past data from cache when offline