3 ms·
Developers first introduced to RxJS hate the fact they have to think about the plumbing rather than the water... that is until they have to inner join 3 asynchr
by spaceribs 6y ago
Developers first introduced to RxJS hate the fact they have to think about the plumbing rather than the water... that is until they have to inner join 3 asynchronous sources of data and broadcast it out to their entire application.
- bzbz 6y agoIs this really a problem? Async/await makes async simple, and using a store like zustand gives you hooks and [g/s]etters out of the box.
- spaceribs 6y agoNothing wrong with Async/Await and zustand, the thing is that it doesn't maintain complexity as more sources are added, let me try to give you an example of the problem that Async/await solves versus what RxJS solves. Say I'm installing a toilet, I need to go out and buy one from the hardware store, remove the old toilet, install the new one, and finally test that it works. It's a linear process that could easily be constructed via a series of async/awaits, and I wouldn't use RxJS to model the behavior. Now, say I'm building a bathroom. You have a shower head, a sink, a toilet, light fixtures, power outlets, tiling, a door, and a window. You have a bunch of contractors. Now you're dealing with N number of sources, N number of tasks that can possibly done in parallel, and N number of possible things you could do in that bathroom depending on how much the bathroom is finished (for instance, if just the plumbing, floor and sink are complete, I can wash my hands) This was always a hard problem, and not one that is especially appreciated, but I can tell you from experience that attempting to just use promises or async/await is not a scalable pattern.