while creating a react component i can define type in these two methods, but i want to know the difference between these two,
Method 1
const MyComponent:React.FC<IProps> = () => (<></>)
interface IProps {
Title: string
}
Method 2
const MyComponent:React.FC = () => (<></>)
MyComponent.propTypes = {
Title: string
}
what is the difference between these two type defining.
while iam trying i got a error,
In method one i tried to add
const MyComponent:React.FC<IProps> = () => (<></>)
interface IProps {
Title: React.FC
}
but, while adding the same thing to the proptype it got error
const MyComponent:React.FC = () => (<></>)
MyComponent.propTypes = {
Title: React.FC
}