"use strict";
var React = require('react');
var ReactDOM = require('react-dom');
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {count: 0};
}
tick() {
this.setState({count: this.state.count + 1});
}
render() {
return (
<div className="text-center">
<h1>
Clicks: {this.state.count}
</h1>
<button className="btn btn-info" onClick={this.tick.bind(this)}>加1</button>
</div>
)
}
}
ReactDOM.render(<Counter />, document.getElementById('app'))
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。