javascript - Reactjs - the spread operator giving error -
i trying use spread operator in react.js getting error unexpected token ... in chrome.
i getting error @ line 3 in code:
var btn=react.createclass({ render: function(){ var { classname, ...other }=this.props; return (<a {...other} classname={joinclasses(classname,"btn")} href="#" >{this.props.children}</a>); } }); and using jsxtransformer.js compiling jsx code.
what doing wrong causing error?
chrome not support ... token yet.
see this page supported browsers (or see below).
spread operation in array literals
- chrome - 46
- firefox - 16
- internet explorer - no
- opera - no
- safari - 7.1
spread operation in function calls
- chrome - 46
- firefox - 27
- internet explorer - no
- opera - no
- safari - 7.1
spread operation in destructuring
- chrome - no
- firefox - 34
see this answer see how set jsx transformer use "es6 transforms".
Comments
Post a Comment