Skip to content

Latest commit

 

History

History
66 lines (51 loc) · 799 Bytes

README.md

File metadata and controls

66 lines (51 loc) · 799 Bytes

@muchobien/apollo-persistence-mapper

Install

npm i @muchobien/apollo-persistence-mapper

or

yarn add @muchobien/apollo-persistence-mapper

Usage

Graphql

query FooQuery {
  foos @persist {
    id
    name
    description
  }
}

or

query FooQuery {
  foos {
    __persist
    id
    name
    description
  }
}

Apollo

import {
  persistenceMapper,
  createPersistLink,
} from '@muchobien/apollo-persistence-mapper';

...

  persistCacheSync({
    cache,
    storage: new MMKVWrapper(storage.instance),
    persistenceMapper,
    trigger: 'write',
    debug: __DEV__,
  });

  const persistLink = createPersistLink();
  
  const client = new ApolloClient({
    cache,
    link: ApolloLink.from([persistLink, httpLink]),
  });