I wanted to show the idea w/o binding to any framework, so the code is somwehwat pseudocodish: some frameworks need adaptations for RxJS (regardless of whether we have a proxy or not)
In RecksJS it can be used as is (because Recks loves Observables 🙂)
In Angular, | async pipe would help to consume values, but the handler would look different
Hey, t7yang! A totally valid question 😅
I wanted to show the idea w/o binding to any framework, so the code is somwehwat pseudocodish: some frameworks need adaptations for RxJS (regardless of whether we have a proxy or not)
In RecksJS it can be used as is (because Recks loves Observables 🙂)
In Angular,
| async
pipe would help to consume values, but the handler would look differentFor React you can try <$> rxjs elements. It exports a
$input
:Here, try this code online 🔗
Or you can use one of many Observable hooks: re-rxjs/react-rxjs, crimx/observable-hooks and LeetCode-OpenSource/rxjs-hooks
☝️ But be cautious not to recreate Observables on each render: use some
useConst
analog.I haven't studied how to adapt RxJS to other frameworks, but you got a general idea.
Please, ping me if you have any questions left
👋
Got it. I am Angular developer, async pipe should work well with this.
ReckJS and <$> pretty interesting. I saw ReckJS before, cool 🥳
Thanks, I'm glad you enjoyed it 🙌
Ah, yeah, Angular is very powerful! And don't forget about the
onPush
change detection strategy! 🙂