Questions should be posted on https://spectrum.chat/next-js
I think something like this should work:
const UserAuth: NextFC<IProps, { authInfo: ..., title: string, model: string }, NextContext> = ({ authInfo, ... }) => {
return (
<div>...</div>
);
};
UserAuth.getInitialProps = async ({ }: NextContext) => {
return {
...
};
};
EDIT: this works assuming you are using @types/next. Otherwise you can check this PR for the next version of Next: https://github.com/zeit/next.js/pull/7337/files
thank you
hellow , i hava a other problem ,
If my first parameter has no value , This must be an empty object.
If removed , error
You have to have the three types, even if one of them is an empty object.
With the latest release of next, you can type your pages like so:
import { NextPage } from 'next'
const Homepage: NextPage<HomepageProps> = () => (
<h1>Hello world</h1>
)
Homepage.getInitialProps = () => ({ ... })
Most helpful comment
With the latest release of next, you can type your pages like so: