Fixing React error: Element type is invalid: expected a string (for built-in co mponents) or a class/function

In React, you can get this error:

Invariant Violation: Element type is invalid: expected a string (for built-in co
mponents) or a class/function (for composite components) but got: object. Check
the render method of `App`.

Typically on a render method that looks correct:

render: function () {
  return ()
}

This error indicates that “ComponentA” is the wrong type of thing, which often happens if you switch module exports to export a list of components instead of just the one.

I.e. from:

module.exports = MyComponent;
module.exports.ComponentA = MyComponentA;
module.exports.ComponentB = MyComponentB;
module.exports.ComponentC = MyComponentC;

The fix is to change what you import:

let ComponentA = require('./Components.jsx').ComponentA;