Redux: clarify Middleware and asynchronous action

I never understand Use Middleware to Handle Asynchronous Actions challenge on Redux tutorials at all? Can someone clarify this challenge please?

  1. Why do we need to have asynchronous action creators? Can you give an example?

  2. What on earth is handleAsync function doing here? Why do we pass in dispatch? Is this dispatch the same as store.dispatch? And why does hint call dispatch argument inside handleAsync as dispatch(...) not store.dispatch(...)? What is dispatch being called upon?

  3. Is handleAsync an action creator like requestingData and receivedData?

  4. If handleAsync is an action creator why does it return a function rather than an object?

  5. What the heaven(!) Is ReduxThunk.default?

This challenge really stopped me. I need to understand this challenge. I can’t even pass the tests?

Thank you very much :pray::pray:

what i did back when i was at this lesson, i told myself, this is something i cannot comprehend in the current moment. I completed the challenges to the best of my abilities. I further looked upon terms like middleware, actions, asynch etc in the given context, to understand as much as i can and i moved on, with the mental note, when i come to the point i need to use Redux, this is where i can come back and revise the content. At this point you dont really have enough information and practice to make sense of all of this and see the logic behind it. The best you can do is learn by heart as much as you can.
To this day im yet to encounter with Redux, but i suppose if im to dig deep enough in frontend web-development, ill have the “pleasure” to meet it again. Funny, im now behind most of the lessons regarding backend and things like middleware and asynchronous have already been a common topic and they make much sense to me and ive utilized them a bit. Dont push yourself too much, have patience and there will be a moment(you might not even feel it come) when all that code will make sense.

1 Like

Thank you, I understand what you say. I’ve done this before, during previous certifications!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.