Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created February 12, 2019 11:20
Show Gist options
  • Save treyhuffine/9259ae0dcf773fad8f9d3294cdb9dbf7 to your computer and use it in GitHub Desktop.
Save treyhuffine/9259ae0dcf773fad8f9d3294cdb9dbf7 to your computer and use it in GitHub Desktop.
React function component with TypeScript
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