DSP Project Report #1. To React, or not to React?

In a previous post, I have declared constant reporting my work o the application, that I am building for Get Noticed (Daj Się Poznać – DSP) contest.

Couple words of introduction for those, who didn’t read my previous posts. I am building a web app for expenses registration and home budgeting. It’s called Finance Grinder and progress can be followed on GitHub.

So let’s start.

Basics

I decided that I don’t want to dive into quite new main technology because I wouldn’t have enough time to learn it, write blog posts and code. And unfortunately, I was right. Despite I am using Ruby on Rails, which I know pretty much, coding takes me a lot of time. It happens so because I want to build front-end using ReactJS.

Ruby on Rails is quite straightforward. It prefers convention over configuration, so you can start developing a new project in minutes. I have described it in this post.

Otherwise, it is with React. Especially when it comes to tailoring it with Rails. You can integrate them in couple ways:

  • by adding gem react-rails (the simplest way)
  • by copying React library file to your project directory (nah, it smells a little bit)
  • by using Webpack
Hello, React!

I was using React before, but it was just a couple of small components to try it out. I didn’t want to put much effort into, so I’ve just added gem. It is really simple. You just need to add gem 'react_rails'  in Gemfile, run bundle , refresh page in browser and React is at your service.

But this is not the best way.

Downloading and copying React source code into project directory also isn’t good practice.

Recently I’ve read a good article on Netguru’s blog. It sais that if you appreciate maintainability and flexibility, you should integrate React using Webpack. I partially agree with that. I’ve even tried their gem react_webpack_rails. But after I saw what amount of code it has generated and how much npm install  has downloaded, I’ve thought that is kind of overkill for my project. Especially at this stage of development. For now, I want to keep things as simple as they can be and focus on coding.

So if you want to be a modern web developer you should use cutting edge modern tools, such as Webpack? This is how it looks. But for sure? I personally don’t think so. For now, I’ll stick to react-rails gem, maybe someday I will need to introduce Webpack.

On the horizon is also a new version of Rails – 5.1 (link). It will introduce Yarn for JavaScript dependency management and Webpack through webpacker gem. I am looking forward to this update, it’s in beta now.

Long way to go

For the afterword, I should admit that projects stage is not as advanced as I would want to. I’ve spent some time reading about React, but it is not wasted time. Now I have to keep up.

Give Finance Grinder a shiny star and stay tuned!