I have made a fair amount of progress working with React and Ruby on Rails 5.1. After some digging, I found there are several ways to go about this:
- Use react on its own and just use the rails api
- Use the react-rails gem
- Use the Shakacode react_on_rails gem
- Use Rails 5.1 yarn’s support directly
I chose the react_on_rails gem as it seemed to do more than react-rails and I like the shakacode.com videos and attitude. They did a lot to pave the way to use yarn to manage the node stack in the rails environment; rails has switched to using yarn with rails 5.1 to manage javascript. You can still use the Rails Asset Pipeline in parallel.
A word of caution. A lot changed from rails 5.0 to rails 5.1 and with the react_on_rails gem, versions 9 and 10, so reading stuff on the web and testing stuff can get a little muddled. It took me a while to get my stack sorted out. I believe if you just start fresh with the latest stuff and go forward, you will be much better off. I feel I should look back at the pure rails way of using yarn, but I believe the shakacode react_on_rails gem offers additional benefits over the rails way (enumerated on web site). I am going forward with the gem as it is working out so far.
So I suggest you read thru the tutorials and videos at www.shakacode.com. It does’t hurt to review
the older stuff so you can see how it has changed. It is also important to review the materials at the reactJS site (www.reactjs.com) so you know what pure react is.
In my next post, I am going to discuss what we are trying to accomplish with these technologies.
We are going to reimplement the Fortran Calculus Portal with react and rails 5.1 to learn as much as we can about these technologies. Mind you, I believe a straight Rails implementation would be fine for this task, but we are trying to learn react! I have learned some interesting things to be reported in subsequent posts.
The portal was previously implemented with CGI/perl/apache some years ago and actually worked quite well and is still useful today; however, it is not an ideal ‘sample’ in my getting a job portfolio.
So onward with the latest technologies.