Skip to content

Instantly share code, notes, and snippets.

@reime005
Created December 27, 2020 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/f49b4476183e60034cfef74670b99e5a to your computer and use it in GitHub Desktop.
Save reime005/f49b4476183e60034cfef74670b99e5a to your computer and use it in GitHub Desktop.
class MyComponents extends React.Component {
constructor(props) {
super(props);
this.state = {
test: 42
};
this.renderSomeText = this.renderSomeText.bind(this);
}
// you could also do this, so no constructor needed
state = {
test: 42,
}
renderSomeText() {
return <text>this.state.test</text>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment