Re:How to Structure React Projects
by endenwer on Sunday November 29, 2015 @03:15PM
(#10645882)
Does anyone use React with RoR? How do you combine them?
[ Parent
| on HN ]
I know of these two projects that offer some guidance to combining RoR with React:
https://github.com/shakacode/react_on_rails
https://github.com/netguru/react_webpack_rails
Basically, you introduce webpack as part of your dev/build pipeline, it interacts nicely with the asset pipeline.
My current preference is the 'browserify-rails' gem. I set up a package.json file to manage my javascript, but I let the regular asset pipeline handle the css and images. I tried webpack for a while, but it seemed redundant when I already had the asset pipeline.
I also like to add 'babelify' to my package.json and 'config.browserify_rails.commandline_options = "-t babelify"' to my application.rb to get ES6 goodness.
Ruby Gem https://github.com/reactjs/react-rails works fine.