I'm using React 0.13.3 with Webpack 1.9.5 and traceur-loader 0.6.3 (tried babel-loader before that), getting TypeError thrown by _classCallCheck() in DefaultRoute 'Cannot call a class as a function'. I don't see where I'm calling a class as a function. This is what my routes look like:
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'));
});
Anyone had this issue before?
Turns out I was using the old this.props.activeRouteHandler()
instead of <RouteHandler/>
in my Application and Home components, which are the top level routes. Doh.
Correct syntax examples here http://rackt.github.io/react-router/ .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.