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
Keef
Keef3y ago
Home():NextPage {}
Home():NextPage {}
That should work
oljimenez
oljimenezOP3y ago
Type 'Element' is not assignable to type 'NextPage<{}, {}>'.
Keef
Keef3y ago
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
Want results from more Discord servers?
Add your server