Branch
Hash :
c3ed5b52
Author :
Date :
2018-03-11T11:11:05
<h2>Full example</h2>
<pre><code>import * as React from 'react';
interface IState {
clicks: number;
}
export class Clicker extends React.Component<any, IState> {
constructor(props) {
super(props);
this.state = {
clicks: 0,
};
}
public clickHandler = () => {
this.setState({ clicks: this.state.clicks + 1 });
}
public render() {
return (
<div>
<p>You have clicked the button {this.state.clicks} time(s).</p>
<p>
<button onClick={this.clickHandler}>click me</button>
</p>
</div>
);
}
}</code></pre>