Questions tagged [reactive-programming]

Reactive Programming is a programming paradigm oriented around data flows and the propagation of change.

Wiki

Reactive programming is a programming paradigm oriented around data flows and the propagation of change.

This means that it should be possible to express static or dynamic data flows with ease in the programming languages used, and that the underlying execution model will automatically propagate changes through the data flow.


Examples

In a Model-view-controller architecture, reactive programming can allow changes in the underlying model to automatically be reflected in the view, and vice versa.

Unlike Dataflow programming, reactive programming paradigm includes automatic update of variables if variables are dependent on other variables.


Related tags

5669 questions
1147
votes
18 answers

What is (functional) reactive programming?

I've read the Wikipedia article on reactive programming. I've also read the small article on functional reactive programming. The descriptions are quite abstract. What does functional reactive programming (FRP) mean in practice? What does reactive…
JtR
  • 20,568
  • 17
  • 46
  • 60
265
votes
1 answer

ReactiveCocoa vs RxSwift - pros and cons?

So now with swift, the ReactiveCocoa people have rewritten it in version 3.0 for swift Also, there's been another project spun up called RxSwift. I wonder if people could add information about what the differences in design/api/philosophy of the two…
Orion Edwards
  • 121,657
  • 64
  • 239
  • 328
252
votes
8 answers

Subject vs BehaviorSubject vs ReplaySubject in Angular

I've been looking to understand those 3: Subject BehaviorSubject ReplaySubject I would like to use them and know when and why, what are the benefits of using them and although I've read the documentation, watched tutorials and searched google I've…
user6015054
174
votes
8 answers

What is the difference between flatmap and switchmap in RxJava?

The rxjava doc definition of switchmap is rather vague and it links to the same page as flatmap. What is the difference between the two operators?
Julian Go
  • 4,442
  • 3
  • 23
  • 28
170
votes
3 answers

RxJS: How would I "manually" update an Observable?

I think I must be misunderstanding something fundamental, because in my mind this should be the most basic case for an observable, but for the life of my I can't figure out how to do it from the docs. Basically, I want to be able to do this: //…
LiamD
  • 1,958
  • 2
  • 13
  • 13
151
votes
10 answers

What is the difference between Observable and a Subject in rxjs?

I was going through this blog and reading about Observables and couldn't figure out the difference between the Observable and a Subject.
Lijin Durairaj
  • 4,910
  • 15
  • 52
  • 85
149
votes
6 answers

Why use Redux-Observable over Redux-Saga?

I have used Redux-Saga. Code written with it is easy to reason so far, except JS generator function is messing up my head from time to time. From my understanding, Redux-Observable can achieve the similar job that handles side effects but without…
134
votes
8 answers

What is "callback hell" and how and why does RX solve it?

Can someone give a clear definition together with a simple example that explains what is a "callback hell" for someone who does not know JavaScript and node.js ? When (in what kind of settings) does the "callback hell problem" occur? Why does it…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
129
votes
1 answer

Correct way of throwing exceptions with Reactor

I'm new to project Reactor and reactive programming in general. I'm currently working on a piece of code similar to this: Mono.just(userId) .map(repo::findById) .map(user-> { if(user == null){ throw new…
davioooh
  • 23,742
  • 39
  • 159
  • 250
125
votes
8 answers

How to 'wait' for two observables in RxJS

In my app i have something like: this._personService.getName(id) .concat(this._documentService.getDocument()) .subscribe((response) => { console.log(response) this.showForm() }); //Output: …
gog
  • 11,788
  • 23
  • 67
  • 129
102
votes
8 answers

Combine a list of Observables and wait until all completed

TL;DR How to convert Task.whenAll(List) into RxJava? My existing code uses Bolts to build up a list of asynchronous tasks and waits until all of those tasks finish before performing other steps. Essentially, it builds up a List and…
Craig Russell
  • 3,534
  • 3
  • 26
  • 27
98
votes
5 answers

Shiny: what is the difference between observeEvent and eventReactive?

I read the Shiny documentation about reactive programming a few times now, but I can't properly understand the difference between observeEvent and eventReactive. The documentation says: Use observeEvent whenever you want to perform an action in…
lucacerone
  • 9,859
  • 13
  • 52
  • 80
92
votes
6 answers

WebClient vs RestTemplate

As per spring 5: WebClient is an interface representing the main entry point for performing web requests. It has been created as a part of the Spring Web Reactive module and will be replacing the classic RestTemplate in these scenarios. The new…
KayV
  • 12,987
  • 11
  • 98
  • 148
91
votes
2 answers

The difference between Reactive and Functional-Reactive programming

I have been doing some research into reactive programming recently and I'm finding it hard to find a good description of the difference between Reactive and Functional-Reactive. Is it simply that the reactive programming is implemented using…
91
votes
9 answers

In RxJava, how to pass a variable along when chaining observables?

I am chaining async operations using RxJava, and I'd like to pass some variable downstream: Observable .from(modifications) .flatmap( (data1) -> { return op1(data1); }) ... .flatmap( (data2) -> { // How to access data1 here ? …
Julian Go
  • 4,442
  • 3
  • 23
  • 28
1
2 3
99 100