docs: function redataComponent(boundRedata, OriginalComponent) {
      var WrapperComponent = function (_PureComponent) {
          _inherits(WrapperComponent, _PureComponent);
  
          function WrapperComponent(props) {
              _classCallCheck(this, WrapperComponent);
  
              // Initialise state with undefined data and WrappedComponent state.
              var _this = _possibleConstructorReturn(this, (WrapperComponent.__proto__ || Object.getPrototypeOf(WrapperComponent)).call(this, props));
  
              var originalComponentState = {
                  state: undefined,
                  nextState: undefined
              };
  
              _this.state = {
                  data: undefined,
                  originalComponentState: originalComponentState
              };
  
              _this._handleOnRedataUpdate = _this._handleOnRedataUpdate.bind(_this);
              _this._handleOnOriginalComponentStateUpdate = _this._handleOnOriginalComponentStateUpdate.bind(_this);
  
              // If it's in the browser, check if there is data coming from server side rendering.
              var serverData = _this._loadFromServerRender();
  
              // Finalise configuration of our redata, and provide it publicly, so that it can be called directly in Server Side Rendering.
              _this.redata = boundRedata(serverData);
  
              // If nothing came from server, redata.
              serverData === undefined && _this.redata({
                  props: {},
                  nextProps: props,
                  state: originalComponentState.state,
                  nextState: originalComponentState.nextState,
                  data: serverData
              }, _this._handleOnRedataUpdate);
              return _this;
          }
  
          _createClass(WrapperComponent, [{
              key: 'componentDidMount',
              value: function componentDidMount() {
                  this._isMounted = true;
              }
          }, {
              key: 'componentWillUpdate',
              value: function componentWillUpdate(nextProps) {
                  // console.log('WrapperComponent::componentWillUpdate');
                  var _state$originalCompon = this.state.originalComponentState,
                      state = _state$originalCompon.state,
                      nextState = _state$originalCompon.nextState;
  
                  // Flow params into redata.
  
                  this.redata({ props: this.props, nextProps: nextProps, state: state, nextState: nextState, data: this.state.data }, this._handleOnRedataUpdate);
  
                  // If OriginalComponent state is changing, store nextState in state.
                  state !== nextState && this._safeSetState({
                      originalComponentState: {
                          state: nextState,
                          nextState: nextState
                      }
                  });
              }
          }, {
              key: 'render',
              value: function render() {
                  // Render extended passing the received props and the spreaded data.
                  return _react2.default.createElement(ExtendedComponent, _extends({}, this.props, this.state.data, {
                      onRedataOriginalComponentStateUpdate: this._handleOnOriginalComponentStateUpdate }));
              }
          }, {
              key: '_safeSetState',
              value: function _safeSetState(state) {
                  if (this._isMounted) {
                      this.setState(state);
                  } else {
                      this.state = _extends({}, this.state, state);
                  }
              }
          }, {
              key: '_loadFromServerRender',
              value: function _loadFromServerRender() {
                  // If data was already available from server.
                  if (typeof window !== 'undefined' && window.__redata && window.__redata.store) {
                      return window.__redata.store[this._componentUniqueId()];
                  }
  
                  return undefined;
              }
          }, {
              key: '_componentUniqueId',
              value: function _componentUniqueId() {
                  // TODO: investigate how to consistently generate this
                  return 'foo';
              }
          }, {
              key: '_handleOnRedataUpdate',
              value: function _handleOnRedataUpdate(data) {
                  console.log('_handleOnRedataUpdate', data);
  
                  this._safeSetState({ data: data });
              }
          }, {
              key: '_handleOnOriginalComponentStateUpdate',
              value: function _handleOnOriginalComponentStateUpdate(state, nextState) {
                  this._safeSetState({
                      originalComponentState: { state: state, nextState: nextState }
                  });
              }
          }]);
  
          return WrapperComponent;
      }(_react.PureComponent);
  
      WrapperComponent.displayName = 'Redata(' + getDisplayName(OriginalComponent) + ')';
  
      // Extend the OriginalComponent, so we get access to lifecycle methods and, consequently, the state changes.
  
      var ExtendedComponent = function (_OriginalComponent) {
          _inherits(ExtendedComponent, _OriginalComponent);
  
          function ExtendedComponent() {
              _classCallCheck(this, ExtendedComponent);
  
              return _possibleConstructorReturn(this, (ExtendedComponent.__proto__ || Object.getPrototypeOf(ExtendedComponent)).apply(this, arguments));
          }
  
          _createClass(ExtendedComponent, [{
              key: 'componentWillUpdate',
              value: function componentWillUpdate(nextProps, nextState) {
                  console.log('ExtendedComponent::componentWillUpdate. Will redata?', !(0, _shallowequal2.default)(this.state, nextState));
  
                  // If OriginalComponent has a componentWillUpdate method, call it first.
                  _get(ExtendedComponent.prototype.__proto__ || Object.getPrototypeOf(ExtendedComponent.prototype), 'componentWillUpdate', this) && _get(ExtendedComponent.prototype.__proto__ || Object.getPrototypeOf(ExtendedComponent.prototype), 'componentWillUpdate', this).call(this, nextProps, nextState);
  
                  // If state changed, inform onRedataOriginalComponentStateUpdate.
                  !(0, _shallowequal2.default)(this.state, nextState) && this.props.onRedataOriginalComponentStateUpdate(this.state, nextState);
              }
          }]);
  
          return ExtendedComponent;
      }(OriginalComponent);
  
      ExtendedComponent.propTypes = {
          // Using a hard to collide prop, which is used to hook into state updates of the OriginalComponent.
          onRedataOriginalComponentStateUpdate: _react.PropTypes.func.isRequired
      };
  
      return WrapperComponent;
  }