Skip to content

Instantly share code, notes, and snippets.

@naoya
Created April 22, 2015 06:46
Show Gist options
  • Save naoya/6c447fad0c7a95f55824 to your computer and use it in GitHub Desktop.
Save naoya/6c447fad0c7a95f55824 to your computer and use it in GitHub Desktop.
var React = require('react');
var App = React.createClass({
getInitialState: function() {
return { members: [] };
},
onClick: function() {
this.setState({
members: ['黄前久美子', '加藤葉月', '川島緑輝', '高坂麗奈']
});
},
render: function() {
var members = this.state.members.map(function(member) {
return <li>{member}</li>;
});
return (
<div>
<button onClick={this.onClick}>響け!ユーフォニアム</button>
<ul>
{members}
</ul>
</div>
);
}
});
React.render(<App />, document.getElementById('app-container'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment