Created
February 12, 2019 11:20
-
-
Save treyhuffine/9259ae0dcf773fad8f9d3294cdb9dbf7 to your computer and use it in GitHub Desktop.
React function component with TypeScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
interface IProps { | |
// ... props interface | |
} | |
// NEW syntax for typing function components | |
const MyNewComponent: React.FC<IProps> = (props) => {...}; | |
// OLD syntax for typing function components | |
const MyOldComponent: React.SFC<IProps> = (props) => {...}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment