How to use the @wora/apollo-offline/lib/ApolloClientIDB.create function in @wora/apollo-offline

To help you get started, we’ve selected a few @wora/apollo-offline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github morrys / offline-examples / apollo / nextjs / apollo / createApolloClient.ts View on Github external
export function createApolloClient(initialState = {}) {
  const httpLink = new HttpLink({
    uri: 'http://localhost:3000/graphql',
  });

  const cacheOptions = {
    dataIdFromObject: o => o.id,
  };

  const persistOptions = {
    initialState,
  };

  const client = ApolloClientIDB.create(
    {
      link: httpLink,
    },
    {
      cacheOptions,
      persistOptions,
    },
  );
  /*
  const client = new ApolloClient({
    link: httpLink,
    cache: new ApolloCache(cacheOptions, cachePersistOption),
  });*/

  client.setOfflineOptions({
    manualExecution: false, //optional

@wora/apollo-offline

@wora Apollo Offline Capabilities

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis