Return to site

ANGULAR INTERVIEW QUESTION: What is reactive programming, and what has it to do with Angular?

· ngInterview,fullstack

Reactive programming is a new paradigm that allows to code from asynchrone data streams, called Observables.

 

broken image

 

The aim of Observables is to propose the same interface to the different JavaScript APIs:

👉 Network calls: XMLHttpRequest, Fetch API, Client HTTP, etc.

👉 DOM events: click, mouseOver, etc, triggered along the way during app use.

👉 Browser methods: setInterval, setTimeOut, etc.

 

Obervable provide a uniform way of dealing with asynchrone processes.

 

Angular teams chose reactive programming for its features:

👉 Guards

👉 HTTP interceptors

👉 Angular HTTP client

👉 Pipes

👉 etc.

 

So reactive programming provides a uniform way of dealing with asynchrone streams in a web app.

The reactive programming is everywhere in an Angular app, and has been chosen explicitly by Google teams in charge of Angular.