These two examples accomplish the same thing. But what are the differences under the hood? I understand functional components vs. React.Component and React.PureComponent, but I haven't been able to find relevant documentation about React.FunctionComponent.
React.FunctionComponent
const MyComponentA: React.FunctionComponent = (props) => { return ( <p>I am a React.FunctionComponent</p> ); };
Plain JS function component:
const MyComponentB = (props) => { return ( <p>I am a plain JS function component</p> ); };
There is no difference under the hood. The first one is using TypeScript syntax to indicate the type of React.FunctionComponent but they are both plain JS function components.
1.4m articles
1.4m replys
5 comments
57.0k users