npm i @muchobien/apollo-persistence-mapper
or
yarn add @muchobien/apollo-persistence-mapper
query FooQuery {
foos @persist {
id
name
description
}
}
or
query FooQuery {
foos {
__persist
id
name
description
}
}
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]),
});