Next.js: NextFunctionComponent type is removed in the latest version

Created on 10 Jul 2019  路  4Comments  路  Source: vercel/next.js

NextFunctionComponent type is removed in the latest version?

  • Version of Next.js: [9.0.0]

Capture

Most helpful comment

For people looking for replacing NextFunctionComponent, you can replace it by:

  • React.FC from "react" for classical components
  • NextPage from "next" for page components that uses getInitialProps

see more: https://stackoverflow.com/a/57441122/3988308

All 4 comments

Hey @saeedghasemi72, this was from @types/next we don't have this type in our codebase. You can use https://github.com/zeit/next.js/blob/canary/packages/next-server/lib/utils.ts#L11 instead.

This is a common use case from version 8. I think that the upgrade guide https://github.com/zeit/next.js/blob/canary/UPGRADING.md should be amended to reflect the changes that need to be made.

For people looking for replacing NextFunctionComponent, you can replace it by:

  • React.FC from "react" for classical components
  • NextPage from "next" for page components that uses getInitialProps

see more: https://stackoverflow.com/a/57441122/3988308

Does any using typescript-eslint know how to fix @typescript-eslint/unbound-method?

It highlights MyComponent in MyComponent.getInitialProps = ...

const MyComponent: NextPage = () => {...}
MyComponent.getInitialProps = ...
Was this page helpful?
0 / 5 - 0 ratings

Related issues

DvirSh picture DvirSh  路  3Comments

renatorib picture renatorib  路  3Comments

havefive picture havefive  路  3Comments

pie6k picture pie6k  路  3Comments

formula349 picture formula349  路  3Comments