@bitspook
Some bad news first
Thinking
in
const model = { . . . };
React.render(<App {...model} />, document.getElementById('app'));
What?
How?
Component
{ property1: 1, property2: 2 . . .}
<div> . . . </div>
Data
UI
User
State
UI
User
Components
Store
{
type: 'WHAT_TO_DO',
}
<MyComponent {...props} />
What to render?
What to do?
React
Redux
vs
Child Component
Parent Component
Child Component
Parent Component
Everything talks in
???
ƒ(x)
Promise
What is an Observable?
What is an Observable?
Observable.interval(300)
.do((v) => console.log(v));
---
Console
---
>
Observable.interval(300)
.do((v) => console.log(v))
.subscribe();
---
Console
---
> 1
> 2
> 3
...
What is an Observable?
Now
Future
Promise
Observable
What is an Observable?
Array
Observable
[1, 2]
How to use Observable?
Source
Sink
Manipulation
How to use Observable?
Source
How to use Observable?
Manipulation: Operators
How to use Observable?
Sink: subscribe
.subscribe({
next: (x) => console.log(x),
error: (e) => console.error(e),
complete: () => console.success("Done!")
})
How to use Observable?
Sink: Observer
{
next: (x) => console.log(x),
error: (e) => console.error(e),
complete: () => console.success("Done!")
}
How to use Observable?
A subscription is valid until:
How to use Observable?
Example
Observable
.from([1, 2, 3, 4, 5]) // source
.map(n => n * n) // manipulation
.filter(n => n % 2) // manipulation
.subscribe(n => console.log(n)); // sink
How to use Observable?
Subject
Observable
Observer
+
Subject
=
Let's build an
App
Child Component
Parent Component
Control flow with Callbacks
Control flow with action emitting Observable
Child Component
Parent Component
. . . build the app
Thank you
@bitspook