Intro to RxJS

Chris Sevilleja

Founder / GDE

Scotch.io

@chrisoncode

Ado Kukic

Developer Evangelist

Auth0

@kukicado

Reactive Programming

  • Programming with asynchronous data streams
  • Tools to combine, create, and filter those streams

Docs Can Get Confusing

mergeAll()

Merges an observable sequence of observable sequences into an observable sequence.

Lodash for events

Asynchronous Data Streams

  • Asynchronous: Give a callback to run when results are returned
  • Data: Raw information such as objects, arrays, numbers, strings
  • Stream: Data/events as they're available over time

Arrays Methods

  • .map()
  • .forEach()
  • .filter()
  • .reduce()

What about streams?

Operators

What are Observables?

Observables === Streams

Promise

Observable

Stream Events

Each stream event can emit three different things:

  • Next: Value or data like an object
  • Error
  • Completed

Observable Examples

Stream === Observable

  • Value or data like an object
  • Error
  • Completed

Why Reactive Programming?

  • Apps are chatty
    • Liking a Tweet
    • Responding to a message
    • Adding a reaction to a post
  • Observables are everywhere
  • Powerful Operators
  • Easier to read
  • Cancellable

Angular Observables

  • Async Processing
  • HTTP
  • Forms and Validation
  • Routing
  • Custom Component Events
    • ​​EventEmitter

Demo!

Intro to RxJS

By Chris Sevilleja

Intro to RxJS

  • 1,090