Created
January 5, 2021 00:29
-
-
Save akersten/9b40ccb09de95f399b5763b4e5378a0e to your computer and use it in GitHub Desktop.
Creates a typed React component class
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'; | |
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