Unverified Commit 945c1fac authored by David Sally's avatar David Sally Committed by GitHub

Update with-emotion-11 example to use functional _app component (#12183)

parent daa7f821
// import App from 'next/app'
import * as React from 'react' import * as React from 'react'
import NextApp from 'next/app'
import { CacheProvider } from '@emotion/react' import { CacheProvider } from '@emotion/react'
import { cache } from '@emotion/css' import { cache } from '@emotion/css'
import { globalStyles } from '../shared/styles' import { globalStyles } from '../shared/styles'
export default class App extends NextApp { // see: https://nextjs.org/docs/advanced-features/custom-app
render() { function MyApp({ Component, pageProps }) {
const { Component, pageProps } = this.props return (
return ( <CacheProvider value={cache}>
<CacheProvider value={cache}> {globalStyles}
{globalStyles} <Component {...pageProps} />
<Component {...pageProps} /> </CacheProvider>
</CacheProvider> )
)
}
} }
// Only uncomment this method if you have blocking data requirements for
// every single page in your application. This disables the ability to
// perform automatic static optimization, causing every page in your app to
// be server-side rendered.
//
// MyApp.getInitialProps = async appContext => {
// // calls page's `getInitialProps` and fills `appProps.pageProps`
// const appProps = await App.getInitialProps(appContext)
// return { ...appProps }
// }
export default MyApp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment