diff --git a/lib/react/user.jsx b/lib/react/user.jsx index 3b4c9ee..c9e4330 100644 --- a/lib/react/user.jsx +++ b/lib/react/user.jsx @@ -1,18 +1,5 @@ "use strict"; -var UserCounter = React.createClass({ - render: function () { - return ( -
  • - - Online - {this.props.count} - -
  • - ); - } -}); - var UserLogin = React.createClass({ authorizeId: function (id) { id = parseInt(id, 10); @@ -60,19 +47,18 @@ var UserLogin = React.createClass({ var UserMenu = React.createClass({ getDefaultProps: function () { return { - count: 0, users: [] }; }, componentDidMount: function () { - socket.on('users:update', this.updateUsers); - }, - updateUsers: function (data) { - this.setProps({ - count: data.count, - users: data.users + var self = this; + socket.on('users:update', function (data) { + self.setProps({ + users: data.users + }); }); }, + updateUsers: , render: function () { var users = this.props.users.map(function (user) { return ( @@ -81,7 +67,12 @@ var UserMenu = React.createClass({ }); return (