Skip to content

Instantly share code, notes, and snippets.

@AlbionaHoti
Last active October 20, 2020 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbionaHoti/22688a0c4fac917a17f3ddaec13fc9b5 to your computer and use it in GitHub Desktop.
Save AlbionaHoti/22688a0c4fac917a17f3ddaec13fc9b5 to your computer and use it in GitHub Desktop.
e-commerce-starter
import '../assets/antd-custom.less';
// Layout Component
import LayoutComponent from '../components/Layout';
// React Context
import { CartProvider } from '../context/Context';
// Apollo
import { ApolloProvider } from '@apollo/client';
import { useApollo } from '../lib/apolloClient';
export default function App({ Component, pageProps }) {
const apolloClient = useApollo(pageProps.initialApolloState);
// useApollo hook will initialize our apollo client
return (
<ApolloProvider client={apolloClient}>
{/**
*
* ApolloProvider will privde the apolloClient
* to every single page of our application.
*
*/}
<CartProvider>
<LayoutComponent>
<Component {...pageProps} />
</LayoutComponent>
</CartProvider>
</ApolloProvider>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment