Rxjs Reactive Programming - rimander123/react-js-training-course GitHub Wiki

RXJS - a Reactive programming library

RxJS is a javascript library for reactive programming so it's important to understand what reactive programming is and whether or not we need it

Reactive programming

Reactive programming is a declarative programming paradigm concerned with data streams and the propagation of change.

You can also conceive reactive programming as a method for writing code that is based on reacting to changes.

For example, in an imperative programming setting,

a = b + c would mean that a is being assigned the result of b + c in the instant the expression is evaluated, and later, the values of b and c can be changed with no effect on the value of a.

On the other hand, in reactive programming, the value of a is automatically updated whenever the values of b or c change. we have declared the relation among a, b and c.

Advantages

Reactive programming comes with the following advantajes:

  • avoid “callback hell”
  • very simple to compose streams of data
  • you end up with a more cleaner, readable code base
  • reduce error-prone code
  • lot of operators that simplify work

So you could consider using reactive programming if you want to bring any of the mentioned advantages.


Next: RxJS