forked from MamchiiYurii/react-intro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.jsx
33 lines (30 loc) · 1.01 KB
/
app.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var Hero = React.createClass({
getInitialState: function() {
return {
count: 0
};
},
handleClick: function () {
this.setState({ count: this.state.count + 1 });
},
render: function() {
return (
<div className="container">
<div className="count">{this.state.count}</div>
<img src={this.props.imageUrl} onClick={this.handleClick} />
<h1>{this.props.title}</h1>
<p>{this.props.subtitle}</p>
</div>
);
}
});
ReactDOM.render(
<div>
<Hero title="React"
subtitle="Библиотека для создания пользовательских интерфейсов"
imageUrl="https://facebook.github.io/react/img/logo.svg" />
<Hero title="Angular 2"
subtitle="Один фреймворк"
imageUrl="https://angular.io/resources/images/logos/angular2/angular.svg" />
</div>,
document.getElementById('root'));