Debian Codegraph @

examples/prism-tsx.html

raw symbols SCIP
1 <h2>Full example</h2>
2 <pre><code>import * as React from 'react';
3
4 interface IState {
5 clicks: number;
6 }
7
8 export class Clicker extends React.Component&lt;any, IState> {
9 constructor(props) {
10 super(props);
11
12 this.state = {
13 clicks: 0,
14 };
15 }
16
17 public clickHandler = () => {
18 this.setState({ clicks: this.state.clicks + 1 });
19 }
20
21 public render() {
22 return (
23 &lt;div>
24 &lt;p>You have clicked the button {this.state.clicks} time(s).&lt;/p>
25 &lt;p>
26 &lt;button onClick={this.clickHandler}>click me&lt;/button>
27 &lt;/p>
28 &lt;/div>
29 );
30 }
31 }</code></pre>