More Related Content
Similar to Intoroduction to React.js
Similar to Intoroduction to React.js (20)
More from Yuto Matsukubo (10)
Intoroduction to React.js
- 10. React.jsvar Counter = React.createClass({
getInitialState() {
return {
count: 0
};
},
onClick() {
this.setState({count: this.state.count + 1});
},
render() {
return (
<div>
<div>count:{this.state.count}</div>
<button onClick={this.onClick}>click!</button>
</div>
);
}
});
DOMの情報もJSで持つ
DOMに対する操作
- 12. var Counter = React.createClass({
getInitialState() {
return {
count: 0
};
},
onClick() {
this.setState({count: this.state.count + 1});
},
render() {
return (
<div>
<div>count:{this.state.count}</div>
<button onClick={this.onClick}>click!</button>
</div>
);
}
}); なんかHTMLっぽいのがまざってるんですけど…
ちょっとまて