mirror of
https://github.com/jbranchaud/til
synced 2026-01-06 16:48:01 +00:00
15 lines
540 B
Markdown
15 lines
540 B
Markdown
# Enable ES7 Transforms With react-rails
|
|
|
|
The [`react-rails`]() gem adds JSX and ES6 transforms to the asset pipeline.
|
|
By using `.js.jsx` and `.es6.jsx` extensions with relevant files, the asset
|
|
pipeline will know to make the appropriate transformation when compiling
|
|
application assets. ES7 transforms are not enabled by default, but can be
|
|
configured. Add the following to the `config/application.js`
|
|
file to allow ES7's *class properties* syntax:
|
|
|
|
```ruby
|
|
config.react.jsx_transform_options = {
|
|
optional: ["es7.classProperties"]
|
|
}
|
|
```
|