Join egghead, unlock knowledge.

Want more egghead? It's 45% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 45% Off

Already subscribed? Sign In

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

    Update RxJS to 5.x

    An overview of RxJS reactive concepts

    André StaltzAndré Staltz

    This video gives an overview of the concepts of reactive programming we saw during this series, and explains how reactive programming can provide true separation of concerns.

    rxjsRxJS
    4 - 5
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:00 Let's zoom out a bit and see what we accomplished. The first thing that you notice from this code, it basically only has var declarations and function definitions. It's a fully declarative code.

    00:13 Apart from, of course, the subscribes here at the bottom. These look somewhat familiar. They are not that much different from document.addEventListener. Giving a custom event such as suggestion one, and a call back. This is pretty much the same idea as this.

    00:36 How did we create our custom events? Well, we did that by applying functions, such as map and merge and flatMap, based on simpler events, such as response, stream, and close, click streams and refresh click streams. That kind of stuff.

    00:55 We learned that everything can be an event stream. We can have an event streams of clicks. We can have event streams for promises, and we can have event streams, also, for data, such as these.

    01:08 Then also look at how we have virtually no control flow keywords here. We don't have ifs, we don't have elses, we don't have for-loops. All of this was created with operators such as map and filter and flatMap. These operators are really important for programming, and they will be your new ifs and for-loops.

    01:34 Finally, let's look how reactive programming brought true separation of concerns to our code. If you want to see how the first user data behaves over time, you only need to look at its declaration.

    01:48 The declaration specifies the complete dynamic behavior over time. There cannot be any other code that will modify the user data. That's a really good guarantee. You can be sure you know, 100 percent, how the user data works just by looking at its definition.

    02:09 That's it and I hope you enjoyed learning about reactive programming in JavaScript.

    Discuss

    Discuss