summaryrefslogtreecommitdiffstats
path: root/frontend/pages/_app.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-05-14 12:01:48 -0400
committerWes Bos <wesbos@gmail.com>2018-05-14 12:01:48 -0400
commit063ee77a7363478c9897c7239724389ef5887df4 (patch)
treed994b7e1cea2f725e6615608028b4bdc4b733ac8 /frontend/pages/_app.js
parent4b46d1369b5ea43acd89e2e274c04a6f6e214e2c (diff)
routing
Diffstat (limited to 'frontend/pages/_app.js')
-rw-r--r--frontend/pages/_app.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js
index c741c4d..65a6fe3 100644
--- a/frontend/pages/_app.js
+++ b/frontend/pages/_app.js
@@ -7,29 +7,28 @@ import { withRouter } from 'next/router';
// This code is taken right from the Next.js docs, and then we add the Router to the page props, which is why we need a custom _app.js
-let ComposedComponent;
-
class MyApp extends App {
- static async getInitialProps({ Component, router, ctx }) {
+ static async getInitialProps({ Component, ctx }) {
+ console.log('GET INITITAL PROPS');
let pageProps = {};
- ComposedComponent = withData(Component);
+ const ComposedComponent = withData(Component);
if (ComposedComponent.getInitialProps) {
- pageProps = await ComposedComponent.getInitialProps(ctx);
+ pageProps = await withData(Component).getInitialProps(ctx);
}
- pageProps.router = router;
- return { pageProps };
+ return { pageProps, query: ctx.query };
}
render() {
- const { Component, pageProps } = this.props;
-
+ console.log('RENDER');
+ const { Component, pageProps, query } = this.props;
+ const ComposedComponent = withData(Component);
return (
<Container>
- <ComposedComponent {...pageProps} />
+ <ComposedComponent {...pageProps} query={query} />
</Container>
);
}
}
-export default withData(MyApp);
+export default MyApp;