Skip to content

Instantly share code, notes, and snippets.

@akersten
Created January 5, 2021 00:29
Show Gist options
  • Save akersten/9b40ccb09de95f399b5763b4e5378a0e to your computer and use it in GitHub Desktop.
Save akersten/9b40ccb09de95f399b5763b4e5378a0e to your computer and use it in GitHub Desktop.
Creates a typed React component class
import * as React from 'react';
export interface $TM_FILENAME_BASE$Props {
$END$
}
export interface $TM_FILENAME_BASE$State {
value: string;
}
export class $TM_FILENAME_BASE$ extends React.Component<$TM_FILENAME_BASE$Props, $TM_FILENAME_BASE$State>{
constructor(props: $TM_FILENAME_BASE$Props) {
super(props);
this.state = {
value: null,
};
}
render() {
return (
<button
className="clazz"
onClick={() => this.setState({value: 'X'})}
>
{this.state.value}
</button>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment