docs: function connectComponentState(component, keys_to_watch_for_changes) {
      var additonal_callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  
      if (!Array.isArray(keys_to_watch_for_changes)) {
        throw keys_to_watch_for_changes + ' must be an array';
      }
      component.state = component.state || {}; // initialize if not set
  
      // call this function whenever the store changes
      function _callback(changed_keys) {
        if (intersection(keys_to_watch_for_changes, changed_keys).length) {
          // only update the state if a key we care about has changed
          var state_update_obj = {};
          keys_to_watch_for_changes.forEach(function (k) {
            return state_update_obj[k] = store._store[k];
          });
          this.setState(state_update_obj);
  
          // if some other custom callback is required by the component
          // call that function as well
          if (additonal_callback) {
            additonal_callback(changed_keys);
          }
        }
      }
      var callback_bound_to_component = _callback.bind(component);
  
      // add keys that map to the store's keys
      var _iteratorNormalCompletion = true;
      var _didIteratorError = false;
      var _iteratorError = undefined;
  
      try {
        for (var _iterator = keys_to_watch_for_changes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
          var k = _step.value;
  
          if (!store._store.hasOwnProperty(k)) {
            throw 'Store does not have key ' + k;
          }
          if (component.state.hasOwnProperty(k)) {
            console.warn('Overwriting existing state key ' + k);
          }
          component.state[k] = store._store[k];
  
          store._recordKeySubscriber(k, component.constructor.name);
        }
      } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
      } finally {
        try {
          if (!_iteratorNormalCompletion && _iterator.return) {
            _iterator.return();
          }
        } finally {
          if (_didIteratorError) {
            throw _iteratorError;
          }
        }
      }
  
      return store.subscribe(callback_bound_to_component);
    }