Skip to content

Instantly share code, notes, and snippets.

@daniilgri
Created June 22, 2020 09:47
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 daniilgri/2c341998e7ece0cc4fbcb9b9b7916de7 to your computer and use it in GitHub Desktop.
Save daniilgri/2c341998e7ece0cc4fbcb9b9b7916de7 to your computer and use it in GitHub Desktop.
import React from "react";
import NextApp from "next/app";
import { ModalProvider } from "styled-react-modal";
import { StyleSheetManager } from "styled-components";
import store from "../store";
import { GlobalStyle } from "../styles/App/styles";
GlobalStyle;
class App extends NextApp {
static async getInitialProps({ Component, ctx }) {
const pageProps = Component.getInitialProps
? await Component.getInitialProps(ctx)
: {};
//Anything returned here can be access by the client
return { pageProps: pageProps };
}
render() {
const { Component, pageProps } = this.props;
return (
<StyleSheetManager disableCSSOMInjection>
<ModalProvider>
<GlobalStyle />
<Component {...pageProps} />
</ModalProvider>
</StyleSheetManager>
);
}
}
export default store.withRedux(App);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment