我将 React 0.13.3 与 Webpack 1.9.5 和 traceur-loader 0.6.3 一起使用(之前尝试过 babel-loader),在 DefaultRoute 'Cannot call a class as a function' 中得到 _classCallCheck() 抛出的 TypeError。我没有看到我在哪里调用一个类作为一个函数。这是我的路线的样子:
var Application = require('./components/Application');
var Home = require('./components/Home');
var About = require('./components/About');
var MainFeedVideos = require('./components/MainFeedVideos');
var MyUploads = require('./components/MyUploads');
...
var routes = (
//logged out content
<Route flux={flux} handler={Application}>
<DefaultRoute handler={Home} />
<Route name='about' handler={About}/>
...
//logged in content
<Route path='/' name='home' handler={Home}>
<DefaultRoute handler={MainFeedVideos} />
<Route name='my-videos' handler={MyUploads}/>
...
</Route>
</Route>);
Router.run(routes, Router.HistoryLocation, function (Handler) {
React.render(<Handler/>, document.getElementById('content'));
});
以前有人遇到过这个问题吗?