1
0
Fork 0
empact/app/app.jsx

33 lines
829 B
React
Raw Normal View History

2015-03-07 08:34:35 +00:00
var Menu = React.createClass({
getInitialState: function() {
return {teams: []};
},
componentDidMount: function() {
this.loadTeams();
},
loadTeams: function() {
$.get(this.props.api, function(res){
this.setState({teams: res})
}.bind(this));
},
render: function() {
var renderTeam = function(team) {
return (
<li className="nav team">{team.name}</li>
)
};
return (
<ul>
<li className="nav empact">Empact</li>
<li className="nav dash">Dashboard</li>
<li className="nav repos">Repos</li>
<li className="nav header">Teams:</li>
{this.state.teams.map(renderTeam)}
</ul>
);
}
});