npmnode.js95% confidence\u2191 859

Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object

Full error message
I am getting this error:

Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

This is my code:

var React = require('react')
var ReactDOM =  require('react-dom')
var Router = require('react-router')
var Route = Router.Route
var Link = Router.Link

var App = React.createClass({
  render() {
    return (
      <div>
        <h1>App</h1>
        <ul>
          <li><Link to="/about">About</Link></li>
        </ul>
      </div>
    )
  }
})

var About = require('./components/Home')
ReactDOM.render((
  <Router>
    <Route path="/" component={App}>
      <Route path="about" component={About} />
    </Route>
  </Router>
), document.body)

My Home.jsx file:

var React = require('react');
var RaisedButton = require('material-ui/lib/raised-button');

var Home = React.createClass({
  render:function() {
    return (
        <RaisedButton label="Default" />
    );
  },
});

module.exports = Home;

In my case (using Webpack) it was the difference between: import {MyComponent} from '../components/xyz.js'; vs import MyComponent from '../components/xyz.js'; The second one works while the first is causing the error. Or the opposite.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/da5516121c32ef1059fc9c1e459422996a9c47d42cf801c7e695ee1087d2872f
hash \u00b7 da5516121c32ef1059fc9c1e459422996a9c47d42cf801c7e695ee1087d2872f
Uncaught Error: Invariant Violation: Element type is invalid… — DepScope fix | DepScope