/** @jsx React.DOM */
App = React.createClass({
getInitialState: function() {
return {
newText: "",
items: [
{ text: "Foo" },
{ text: "Bar" },
{ text: "Buzz" }
]
};
},
addItem: function(event) {
event.preventDefault();
this.setState({
items: [{text : this.state.newText}].concat(this.state.items),
newText: ""
})
},
updateNewText: function(event) {
this.setState({
newText : event.target.value
});
},
render: function() {
return
Ճ
ɹ
{this.state.items.map(function(item) {
return {item.text};
})}
;
}
});
React.render(, document.body);
P.2 - ΞΠςϜΛՃ