Web Development

Should I Use RxJS in My Project?

May 12, 2017

If you’re thinking about using RxJS, you might as well be asking, “Should I use a jump kick in a street fight?” Unless you are Bruce Lee, probably not.

As a disclaimer, I am not an RxJS pro. I only started learning about it a couple of weeks ago. Consider this post a record of my thoughts as I begin to learn about this powerful library.

According to their website, RxJS is a library for composing asynchronous and event-based programs by using observable sequences. I have been researching whether or not this would be a good fit for one of our current projects. 

So, Is It Worth It?

Front-end Dev Lead Elisha and I discuss RxJS in a recent video:

I’ve heard that once your brain gets plugged into the stream everything will begin to make sense and you’ll eventually reach the promised land. But until you reach that point, it’s a dangerous path, as there are many wrong ways to do things. If you have not yet reached RxJS enlightenment, you might fall into such anti-patterns like the
nested subscribe pattern or imperative subscription management.

However, if you can avoid these mistakes and learn some of the commonly used operators like map, filter, do, mergeMap, and switchMap, you’ll be in decent shape. It also helps to visualize observables as marbles of events floating down a stream of time. And RxJS provides a multitude of operators to help you manage those streams. So far, I’ve only learned a handful, but they were enough to get a simple photo search dropdown working with infinite scroll, http cancellation, and debounced input.

So that brings us to the original question.

Should I Use RxJS in My Project?

Well, like many other questions, the answer is: It depends. Do you have the time and budget to learn this new tool which is known to have a steep learning curve? Will your project have complex async requirements that RxJS may bring clarity to? Are you using Angular2, which comes with RxJS out of the box? Will your current framework and lodash suffice for your needs? After reading numerous articles, watching tutorial videos, and building a simple proof of concept, I came to the conclusion that, while RxJS could make my life easier, time spent learning RxJS would add up to unnecessary overhead for a typical CRUD web app project.

RxJS is indeed a powerful tool, and I have only begun to see its potential. I may revisit this library in the future, but, for now, I haven’t encountered a project where the efficiency benefits outweigh the the cost of learning and implementing it.

Travis Luong

Full-Stack Developer

Travis is a Full-Stack Developer at Fresh who also loves working out, making game apps, and sourcing good bubble tea. His motto is to appreciate balance in life—and find zen in coding.

You might also like...



You Should Be Using BitBucket Pipelines

Commonly, developer workflows include pushing code to BitBucket. From there, you run processes like testing, updating a staging server, and generating documentation. All of these processes can become very repetitive. Thankfully, they can also be automated. That’s where Bitbucket Pipelines comes in. It’s simple – you only have to create a set of scripts that run … Continued



Unit/Automated Testing

Software testing is the process of discerning whether a product is acceptable to its end users, its target audience, its purchasers, and the stakeholders to whom it belongs. At its core, software testing examines code and its execution: does the code do what it is supposed to do, when it is supposed to do it, … Continued



The Definition of Done

In development, we often split tasks up into smaller pieces and distribute them among multiple developers. We need to eventually bring this work back together, and this is easier when everyone agrees on what “done” means. The definition of “done” is important in Scrum for calculating velocity – “a measure of the amount of work … Continued