Created
June 26, 2020 11:51
-
-
Save velotiotech/59cec6edcf21ddaad944d6155fd5d3d2 to your computer and use it in GitHub Desktop.
This file contains 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
export default class CounterApp extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
timeThen: ..., | |
timeNow: Date.now() | |
}; | |
this.someAction = this.someAction.bind(this); | |
this.anotherAction = this.anotherAction.bind(this); | |
this.yetAnotherAction = this.yetAnotherAction.bind(this); | |
} | |
someAction() { /* some action */ } | |
anotherAction() { /* another action */ } | |
yetAnotherAction() { /* yet another action */ } | |
render() { | |
return (<div> | |
{this.state.timeThen > this.state.timeNow ? ( | |
<> | |
<button onClick={this.someAction} /> | |
<button onClick={this.anotherAction} /> | |
</> | |
) : ( | |
<button onClick={this.yetAnotherAction} /> | |
)}</div>); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment