How to use the soya-next/pages.withApolloClient function in soya-next

To help you get started, we’ve selected a few soya-next 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 traveloka / soya-next / examples / apollo / hocs / createApolloPage.js View on Github external
import { withApolloClient } from "soya-next/pages";
import { ApolloClient } from "apollo-client";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import config from "config";
import fetch from "isomorphic-unfetch";

const configureApolloClient = apolloState =>
  new ApolloClient({
    link: new HttpLink({ uri: config.graphqlEndpoint, fetch }),
    cache: new InMemoryCache().restore(apolloState)
  });

export default withApolloClient(configureApolloClient);