覆盖_app.js时,getInitialProps的用途是什么?

这到底是做什么的?

pageProps =等待Component.getInitialProps(ctx)

它看起来像“ pageProps”,这只是一个空对象

import App, {Container} from 'next/app'
import React from 'react'

export default class MyApp extends App {
  static async getInitialProps ({ Component, router, ctx }) {
    let pageProps = {}

    if (Component.getInitialProps) {
      pageProps = await Component.getInitialProps(ctx)
    }

    return {pageProps}
  }

  render () {
    const {Component, pageProps} = this.props
    return <Container>
      <Component {...pageProps} />
    </Container>
  }
}