未验证 提交 945c1fac 编写于 作者: D David Sally 提交者: GitHub

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

上级 daa7f821
// import App from 'next/app'
import * as React from 'react'
import NextApp from 'next/app'
import { CacheProvider } from '@emotion/react'
import { cache } from '@emotion/css'
import { globalStyles } from '../shared/styles'
export default class App extends NextApp {
render() {
const { Component, pageProps } = this.props
return (
<CacheProvider value={cache}>
{globalStyles}
<Component {...pageProps} />
</CacheProvider>
)
}
// see: https://nextjs.org/docs/advanced-features/custom-app
function MyApp({ Component, pageProps }) {
return (
<CacheProvider value={cache}>
{globalStyles}
<Component {...pageProps} />
</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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册