Skip to content

muchobien/apollo-persistence-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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]),
  });

Releases

No releases published

Packages

No packages published