From 81f4f870294d1641bd33aea5b08cf66e37e376e8 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Tue, 15 May 2018 14:35:34 -0500 Subject: Added a custom render in _app --- frontend/pages/_app.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'frontend/pages/_app.js') diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js index ccbc3ae..38c72c3 100644 --- a/frontend/pages/_app.js +++ b/frontend/pages/_app.js @@ -1,12 +1,14 @@ -import { ApolloApp } from 'next-with-apollo'; +import App, { Container } from 'next/app'; +import { ApolloProvider } from 'react-apollo'; import withData from '../lib/withData'; import { CURRENT_USER_QUERY } from '../queries/queries.graphql'; +import Page from '../components/Page'; // Next.js wraps each Page in an component. This is handy for when you want to persist anything from page to page, or just access a component that is 1 level higher than each page. -// normall here you import App from next/app, but we use next-with-apollo's ApolloApp here so we can get SSR +// here we use App from next/app and wrap it with withData so we can get Apollo and SSR -class MyApp extends ApolloApp { +class MyApp extends App { componentDidMount() { if (typeof window !== 'undefined' && !window.__CLIENTLOADED__) { console.log('Refetching current user'); @@ -25,6 +27,17 @@ class MyApp extends ApolloApp { return { pageProps }; } + render() { + const { Component, pageProps, apollo } = this.props; + + return ( + + + + + + ); + } } export default withData(MyApp); -- cgit v1.3