Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2021 22:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
pages/_app.js with ApolloProvider
import App from 'next/app';
import Head from 'next/head';
import { AppProvider } from '@shopify/polaris';
import { Provider } from '@shopify/app-bridge-react';
import '@shopify/polaris/dist/styles.css';
import translations from '@shopify/polaris/locales/en.json';
import Cookies from 'js-cookie';
import ClientRouter from '../components/ClientRouter';
import ApolloClient from 'apollo-boost';
import { ApolloProvider } from 'react-apollo';
const client = new ApolloClient({
fetchOptions: {
credentials: 'include'
class MyApp extends App {
render() {
const { Component, pageProps } = this.props;
const config = { apiKey: API_KEY, shopOrigin: Cookies.get("shopOrigin"), forceRedirect: true };
return (
<title>Sample App</title>
<meta charSet="utf-8" />
<Provider config={config}>
<ClientRouter />
<ApolloProvider client={client}>
<Component {...pageProps} />
export default MyApp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment