Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Last active February 9, 2019 21:37
Show Gist options
  • Save treyhuffine/3041c38c1c97a18408ae97ad09224053 to your computer and use it in GitHub Desktop.
Save treyhuffine/3041c38c1c97a18408ae97ad09224053 to your computer and use it in GitHub Desktop.
A TypeScript functional component
import * as React from 'react';
interface IProps {
name?: string;
}
const Header: React.FC<IProps> = (props: IProps) => (
<h1>Hello, {props.name}! Welcome to React and TypeScript.</h1>
);
Header.defaultProps = {
name: 'world',
};
export default Header;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment