'use strict';

var React = require('react');

var SessionStore = require('../stores/SessionStore');

function _getState() {
  return {
    session: SessionStore.getSession()
  };
}

function _onChange(store, callback) {
  var stateChange = {};
  stateChange[store] = callback();
  this.setState(stateChange);
}

var App = React.createClass({
  _listeners: {},
  getInitialState: function() {
    return _getState();
  },
  componentDidMount: function() {
    this._listeners.session = _onChange.bind(this, 'session', SessionStore.getSession);
    SessionStore.addChangeListener(this._listeners.session);
  },
  componentWillUnmount: function() {
    SessionStore.removeChangeListener(this._listeners.session);
  },
  render: function() {
    return (
      <div className='container'>
        {this.props.children}
      </div>
    );
  }
});

module.exports = App;

'use strict';

var React = require('react');

var SessionStore = require('../stores/SessionStore');

function _getState() {
  return {
    session: SessionStore.getSession()
  };
}

function _onChange(store, callback) {
  var stateChange = {};
  stateChange[store] = callback();
  this.setState(stateChange);
}

var App = React.createClass({
  _listeners: {},
  getInitialState: function() {
    return _getState();
  },
  componentDidMount: function() {
    this._listeners.session = _onChange.bind(this, 'session', SessionStore.getSession);
    SessionStore.addChangeListener(this._listeners.session);
  },
  componentWillUnmount: function() {
    SessionStore.removeChangeListener(this._listeners.session);
  },
  render: function() {
    return (
      <div className='container'>
        {React.cloneElement(this.props.children, {session: this.state.session})}
      </div>
    );
  }
});

module.exports = App;

Fix propagation of session as property
Fix propagation of session as property
