DEV Community

sunflowerseed
sunflowerseed

Posted on

I feel a little overwhelmed by middleware, redux-thunk, redux-saga

I was a little bit shocked by Promises, Await / Async, Generators, a function that can "stop" in the middle and continue to run and all that.

And then I got shocked by the React virtual DOM and diff'ing, and the PureComponent, React.memo, and useMemo, all those to optimize re-rendering.

And then I got shocked by Redux, how the store, action, reducer, works.

And then by React-redux, how it has a Provider and the connect and how it makes a container and pass in the props to a component.

After I got through all those...

And then now, by Redux-thunk and Redux-saga... knowing thunk is a computer science concept that dated back to 1960 and redux-saga is all those await / async stuff... both thunk and saga are just to do some Ajax.

Quite frankly, I am quite overwhelmed... does anybody feel the same?

Top comments (2)

Collapse
 
kathryngrayson profile image
Kathryn Grayson Nanz • Edited

Very much so! I would say dealing with all the middleware is my least favorite part of my job. I think a lot of folks (myself included, at times) are willing to take it as "black magic." Meaning they'll follow whatever tutorials they can find that happen to be close enough to what they're working on, get it functional, and call it a day – all without actually knowing what's happening or why it works.

You didn't ask for advice, so disregard the below if you're not looking for any (I'm just a perpetual advice-giver, haha):
I've found it helpful to really try and question what's happening. Asking myself (or someone else) "okay, what is this really doing?" Sometimes this is reading the docs, sometimes it's looking at the source code, and sometimes it's just asking a more senior dev on my team to break it down for me. If I can figure out even a semblance of what's happening "behind the curtain", it makes it a lot easier to actually understand and remember vs just memorizing and regurgitating boilerplate because you know it works (until it doesn't...)

All that to say – you're definitely not alone on this one.

Collapse
 
sunflower profile image
sunflowerseed • Edited

=)

yeah, sometimes I ask questions and people also don't seem to understand it fully... some say you have to use a key={id} or else if you use key={index} the data on screen may show incorrect data but when everything is correct people don't know why and how to show an example of it not working. (and I later found out the data on screen won't be incorrect; it is just inefficient).

Is this so-called "declarative way" of programming instead of imperative? If you tell me use setA intersect setB and it is "declarative" and don't write a loop to do it imperatively, that I understand completely. React / Redux's way of "declarative" somehow isn't that fully understood. A lot of times, it is do this, do that, and you will have it. It is similar to Ruby on Rails and "pragmatic" way of programming: just do this and do that and it should work and people don't know why or how it works that deeply.