-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
41 lines (34 loc) · 927 Bytes
/
index.html
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
34
35
36
37
38
39
40
41
<!doctype html>
<title>react-pokemon</title>
<script src="//fb.me/react-0.10.0.min.js"></script>
<script src="//fb.me/JSXTransformer-0.10.0.js"></script>
<script src="pokemon.js"></script>
<main></main>
<script type="text/jsx">
/**
* @jsx React.DOM
*/
var App = React.createClass({
getInitialState: function () {
return {
name: 'pikachu'
};
},
updateName: function () {
this.setState({
name: this.refs.name.getDOMNode().value
});
},
render: function () {
return <div>
<input ref="name" onChange={this.updateName} value={this.state.name} />
<br />
<Pokemon name={this.state.name} />
</div>;
}
});
React.renderComponent(
<App />,
document.querySelector('main')
);
</script>