getInitialProps in next.js code example
Example: next js _app getinitialprops
import App from 'next/app';
const MyApp = ({ Component, pageProps, apollo }) => (
<ApolloProvider client={apollo}>
<Component {...pageProps} />
</ApolloProvider>
);
MyApp.getInitialProps = async (appContext) => {
const appProps = await App.getInitialProps(appContext);
return { ...appProps };
};
export default withApollo(appWithTranslation(MyApp));