DEV Community

Discussion on: RxJS with React: Actions and Subjects

Collapse
 
farzadofficial profile image
Farzad

A very well written article, thank you for your time and effort :)

I am amazed at how effortless and easier is over something like Redux + RxJS.

Your useObservable() custom hook is much easier than useReducer(). I have added a tiny tweak on top of your useObservable, 1) changed the return from an array to object, 2) returning action$ alongside state and dispatch, so if there was a need for other observables to be based on initial observable, you could easily pass the action$ to those ones.

Here is a little demo I have put together, hope it helps those interested to learn RxJS :)

codesandbox.io/s/falling-cloud-1m4v8

Thanks