reactjs - missing ) after argument list when using react-router -
i'm using react-router v0.13.3 , react 0.13.3 build simple web app. big issue happened when tried integrate react-router.
so, here's error message: uncaught syntaxerror: missing ) after argument list
app.jsx
var router = window.reactrouter; var route = router.route; app.view_search = 'search_view'; app.view_favorite = 'favorite_view'; app.view_result = 'result_view'; var routehandler = router.routehandler; var app = react.createclass({ render () { return ( <div> <h1>app</h1> <routehandler/> </div> ) } }); // declare our routes , hierarchy var routes = ( <route handler={app} path="/"> <route path="search" handler={app.searchview}/> <route path="about" handler={app.aboutview}/> <router.defaultroute handler={app.searchview}/> </route> ); router.run(routes, router.historylocation, (root) => { react.render(<root/>, document.body); });
the main javascript codes pasted above, error appeared when added last 3 lines. , web app using bower manage dependencies.
if use
router.run(routes, router.historylocation, function(handler) { react.render(<handler/>, document.body); });
to replace last 3 lines. nothing shows on screen. know how solve it?
the parenthesis error because of arrow function use. ecmascript 6 feature , not supported browsers unfortunately.
since use gulp, easy add babel build steps. otherwise, use 'old' notation: function(root) {return ...}
as second issue point in comments, need source code of root
try understand what's happening.
Comments
Post a Comment