withApollo
: Wraps a page into an ApolloProvider
and handles state rehydration between CSR navigation.getInitialProps
by default, only when useGetInitialProps: true
(meant for pages using getInitialProps
only).withHOCTemplate
: Template for quickly getting started with a new HOC, meant as a utility. Feel free to customise it!This HOC is necessary for all pages in the demo, because all pages need data that are used by shared component (i.e: Nav, Footer).
If you don't need to fetch data from a data source, then you don't need to use it.
1
2
3
4
5
6
7
// Example for a page using getStaticProps or getServerSideProps
export default (ExampleHomePage);
// Example for a page using getInitialProps
export default withApollo({ useGetInitialProps: true })(ExampleHomePage);
useGetInitialProps
option anywhere in this demo, because we don't use getInitialProps
anymore.