Skip to content

Instantly share code, notes, and snippets.

@jamesreggio
Last active December 11, 2017 18:04
Show Gist options
  • Save jamesreggio/ca187d77ffcea11d2c8142bc514f1d22 to your computer and use it in GitHub Desktop.
Save jamesreggio/ca187d77ffcea11d2c8142bc514f1d22 to your computer and use it in GitHub Desktop.
apollo-cache-persist quickstart example for React Native
import { InMemoryCache } from ‘apollo-cache-inmemory’;
import { persistCache } from ‘apollo-cache-persist’;
import { AsyncStorage } from ‘react-native’;
// Set up your cache.
const cache = new InMemoryCache({...});
// Set up cache persistence.
persistCache({
cache,
  storage: AsyncStorage,
trigger: 'background',
});
// Finish configuring Apollo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment