Skip to content

Instantly share code, notes, and snippets.

@jlittlejohn
Created May 3, 2019 01:19
Show Gist options
  • Save jlittlejohn/9005335e590cb6c8a07cf526a98cde03 to your computer and use it in GitHub Desktop.
Save jlittlejohn/9005335e590cb6c8a07cf526a98cde03 to your computer and use it in GitHub Desktop.
REACT: Class Component with Constructor - TypeScript
export interface ButtonProps {
label?: string;
}
export interface ButtonState {
//
}
class Button extends React.Component<ButtonProps, ButtonState> {
constructor(props: ButtonProps) {
super(props);
this.state = {
//
};
}
render() {
return <button>{this.props.label}</button>;
}
}
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment