I am trying to learn how to use Typescript with react and I understand that I can create the following using typescript:
import { FC } from 'react'
interface ChildProps {
color: string
}
const Child: FC<ChildProps> = ({color}) => {
return <div>{color}</div>
}
What I want to know is how can I do this with a "traditional" function. I.e., something like this:
function Child: FC<ChildProps>({color}) {
return <div>{color}</div>
}
Now, this does NOT work. I get errors. For example here is one error that I get:
What I am wondering is how is it possible to reproduce this using a traditional js function? If so, how?
Any ideas?
Thanks.
