Playing with RxJS

It’s the latest thing - RxJS. If you’ve peeked into the freeCodeCamp source code, you’ve seen it. If you’ve watched a talk given by anyone from Netflix, you’ve heard of it. If you’ve got your head around functional programming and promises, you’ll want to learn it. Reactive programming isn’t new (it’s older than I am, and I wouldn’t call myself “new”), but Microsoft has been working hard to bring it back into our consciousness by writing reactive extensions for various languages. RxJS is the JavaScript flavor, and I recently decided to assimilate it into my personal technological collective, adding its distinctness to my own. Here’s my simple project that demonstrates the techniques and concepts I learned:

I’m really happy with the outcome, and once reactive programming clicked, adding new features was easy. Not only that, but the code is quite readable, and that’s what it’s all about at the end of the day. I feel like I’ve made some significant advancement in my programming skills, and I’ve only scratched the surface!

3 Likes

Oh, sorry. I never feel settled so i immediately broke my code to play with error handling. I’ll get it working again and make a fork to play with.

Edit: We should be all set!

This looks really neat. One article I found that helped me understand what reactive programming even is, was this one on gist. @PortableStick if you could share what you used to write that app, it’d be great! I’m going to try and use this library as soon as I can.

1 Like

Just updated my pen with error handling, a loading spinner for user feedback, and squashed a bug whereby clicking a button before entering text into the filter wouldn’t do anything.

It turns out, I didn’t need to use the document's load event for the initial list render!

I think my experiment might have gone a bit faster if I had that found that gist, actually. My initial resource was something I used over a year ago to learn functional programming

LearnX

Other than that, it was mainly the documentation and Google. I had to figure a lot out because there aren’t any examples that I could find of someone making a filter for a list, but it really is just a simple application of reactive principles at work. I hope this does help someone else, though, because most of the other examples that I saw were just a bit too trivial for my taste.

1 Like

Wow, that first link ! Did you know it was almost the whole “Functional programming” section on FCC last year when I started out ? It wasn’t easy, particularly when chaining 6-7 methods together (what a mess of braces/semicolons) But it really opened my eyes (more recently) concerning the power of functionnal programming.

1 Like

Yup! That’s where I found it. I was excited because I had finally nailed the functional section (it took a few weeks of head-desk interaction) when they removed it from the curriculum. I went back to it on Thursday because I remembered it had a section on reactive programming that I never touched. It was nice to breeze through the functional programming exercises, too. Shows me how far I’ve come! :smiley:

1 Like