react-router: react-router 0.13.2 Uncaught TypeError: Cannot call a class as a function
Hi
I’m getting an error when trying to render this simple page with react 0.13.0 and react-router 0.13.2.
var React = require('react');
var Router = require('react-router');
var Route = Router.Route;
var RouteHandler = Router.RouteHandler;
var App = React.createClass({
render: function() {
return (
<div> </div>
);
}
});
var routes = (
<Route handler={App} name="app" path="/">
</Route>
);
Router.run(routes, function (Handler, state) {
React.render(<Handler/>, document.getElementById('content'));
});
Chrome complains about the following line.
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
The page renders fine if I remove react-router. Any ideas of what could be wrong?
Cheers, -Kristoffer
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 23 (10 by maintainers)
I ran into the same issue while working through a node server + react-router example. In that case, server.js was calling node-jsx.install(). I was running 0.2 of node-jsx (from the isomorphic-react example). Upgrading to 0.13.3 fixed the issue.
A generic tl;dr to this issue is “upgrade your jsx transpiler”.