What does NextPage in Next.js do?

Viewed 4262

I just started using TypeScript with Next. What does this do? import { NextPage } from 'next'; export const Page: NextPage = () => {} I looked at the docs but it does really give a good explanation in what it does.

I am guessing by the name that it routes pages. Can someone please explain what this does?

Thank you.

1 Answers

My advice is to start here, but in brief:

import { NextPage } from 'next';

export const Page: NextPage = () => {}

NextPage is a type exported by NextJS. When we write Page: NextPage we're saying that our Page component is of type NextPage.

Related