ensl_gathers/public/js/app.js
2015-07-20 23:47:18 +01:00

17 lines
No EOL
572 B
JavaScript

var MenuCounter = React.createClass({displayName: "MenuCounter",
componentDidMount: function () {
socket.on('gatherCount', this.updateCount)
},
updateCount: function (data) {
this.setProps({count: data.count});
},
render: function () {
return (
React.createElement("li", null,
React.createElement("a", {href: "#"}, React.createElement("i", {className: "fa fa-users fa-fw"}), " Gatherers (", this.props.count, ")")
)
);
}
});
React.render(React.createElement(MenuCounter, {count: 0}), document.getElementById('side-menu'));