function replaceComponent(name, newComponent, ...newHocs) {
  // support single argument syntax
  if (typeof arguments[0] === 'object') {
    // eslint-disable-next-line no-redeclare
    var { name, component, hocs = [] } = arguments[0];
    newComponent = component;
    newHocs = hocs;
  }

  const previousComponent = ComponentsTable[name];
  const previousHocs = (previousComponent && previousComponent.hocs) || [];

  if (!previousComponent) {
    // eslint-disable-next-line no-console
    console.warn(
      `Trying to replace non-registered component ${name}. The component is ` +
        'being registered. If you were trying to replace a component defined by ' +
        "another package, make sure that you haven't misspelled the name. Check " +
        'also if the original component is still being registered or that it ' +
        "hasn't been renamed."
    );
  }

  return registerComponent(name, newComponent, ...newHocs, ...previousHocs);
}
Replace a Vulcan component with the same name with a new component or
an extension of the raw component and one or more optional higher order components.
This function keeps track of the previous HOCs and wrap the new HOCs around previous ones

@param {String} name The name of the component to register.
@param {React Component} newComponent Interchangeable/extendable component.
@param {...Function} newHocs The HOCs to compose with the raw component.
@returns {Function|React Component} A component callable with Components[name]

Note: when a component is registered without higher order component, `hocs` will be
an empty array, and it's ok!
See https://github.com/reactjs/redux/blob/master/src/compose.js#L13-L15