ericclemmons/grunt-react

Cannot transfer props using JSX destructuring assignment

willdady opened this issue · 2 comments

I'm using grunt-react v0.10.0 with Browserify and if fails to parse the new JSX way of selectively transferring props using destructuring assignment. Basically adding this line inside my component's render function...

var { checked, ...other } = this.props;

...results in this error:

Error: Parsing file /path/to/my/component/MyComponent.jsx: Line 26: Unexpected token ...

EDIT:
So I assume is to do with not having harmony=true set. How do I enable this when used with Browserify?

https://github.com/jmreidy/grunt-browserify/blob/master/README.md#transform

The grunt-browserify README specifies how to pass options to transforms. In the options has for your browserify task, try:

transform: [ [ require('grunt-react').browserify, { harmony: true } ] ]

Cheers.