Typescript const to functions component type.
How to convert this const to function in typescript
const Home: NextPage = () => {
return <>...</>
}
to
//where NextPage type will go?
function Home () {
return <>...</>
}
3 Replies
That should work
Type 'Element' is not assignable to type 'NextPage<{}, {}>'.
Yeah so its probably not the right type for that function sec.
React.FunctionComponent I think is what you should be using instead
Or JSX.Element
You don't really need to explicitly type if implicit typing is available with typescript unless your code standards dictate that
TS knows what it'll be