I am using react-rails
, and I'm trying to render server side using the prerender
option:
<%= react_component('MyComponent', @data, {prerender: true}) %>
When I do this, I get an error as a result of const
:
Exception: SyntaxError: Unexpected keyword 'const'. Const declarations are not supported in strict mode.
The const
keyword, IIUC, is available in ES6, so it needs to be transpiled in some way. I'm trying to figure out how to tell react-rails to transpile the ES6. It seems like config.react.jsx_transform_options
is the way to specify, it, but I've added the following to application.rb and it does not have any effect:
application.rb:
config.react.jsx_transform_options = {
whitelist: [
"es6.constants",
],
}
What am I doing wrong here?