Redux Toolkit Tutorial - 16 - Redux Thunk Middleware

preview_player
Показать описание


📱 Follow Codevolution

Redux Thunk Middleware
Redux Toolkit Tutorial
Рекомендации по теме
Комментарии
Автор

Those who are struggling with the TypeError: middleware isn't a function try this "const { thunk } = require('redux-thunk')" for requiring the redux-thunk as package is updated right now.

AkashGauravchannel
Автор

Even my english is not perfect, i can understand you! Your teaching skills climbs over language barriers

omersaglam
Автор

const chain = middlewares.map((middleware) => middleware(middlewareAPI));
^

TypeError: middleware is not a function

I'm getting this error, I checked whether our code is same or not. everything is same until now. my redux version is 5.0.0 and redux-thunk version is 3.1.0

nayabrasool
Автор

Thank you so much for this playlist, I've just finished it and I feel far better about redux and redux-thunk in general, I'll be recommending your videos to any developer I know because I think you deserve much more following than this, and finally, I can't wait for more videos from this list, and I agree with people who commented here, it would be really nice to explore 'redux-saga' as well.

anasazkoul
Автор

whenever i want to learn something, your channel comes to mind!

edemduku
Автор

For those of you who got an error, though your code is the same as his, make sure to synchronize the version of your dependencies in package.json with the ones he installed for this tutorial

dqsflqf
Автор

if I want to obtain the data and update my state, why can't I define the fetchUsers() with axios and call store.dispatch in it. and fire fetchUsers() in the end. what's the point of using thunk. I kind of lost.

ycchang
Автор

Codevolution is such a source of valuable knowledge.

benarcher
Автор

I am stucking with usage of redux thunk and I didn't know why should I use redux thunk. Now I completely understand it and about middleware by learning from ur video. Nice teaching skill sir.

narahiromichi
Автор

Awesome video as always man!!! You have the magic of explaining the most complex topic in a very simple fashion... can u start videos on AWS Serverless also?

kedarpethe
Автор

Steps:
1. State:
2. Constants for Actions:
3. Action Creators:
4. Reducer:
5. Create Store & Link:
1. import thunk middleware and pass to applymiddleware
2. define async action creator:
3. axios request with dispatch the necessary actions (before axios, after response, after error):
4. subscribe to our store & dispatch this asynchronous action creator with store

vigneshgvs
Автор

Thankyou Vishwas Sir, you made Redux Thunk very understandable, can you please prepare a tutorial for Saga and how to connect that with an api_service layer ?

MyGURUPREET
Автор

Hi Vishwas thanks for the lesson. My question is when you create fetchUsers function does redux understand it automatically this is the thunk middleware and the middleware will log and process that? What if we have multiple API calls? What would you do in that situation?

HoangNguyen-zvxb
Автор

there is no mentioning of thung if fetchUsers, what functionality does thunk add when it comes to fethUsers, posibility to pass dispatch? Axios call is anychnronious, but, the code inside then.... catch blos is synchronious, it synchroniously processes the returned response. Also, dispatch(action) happens also synchroniously, it does't get picked up by any side API to be returned later to an event loop. So, again, which part of fetchUsers wouldn't run in absence of redux-thunk?

ikurbano
Автор

Easy to follow along, thanks!
Do you have a link to the github repository at all?
I am getting an error when node asyncActions.js which is probably due to a spelling mistake somewhere on my behalf, so it'd be great if you had your repository I could compare it to.
Thanks in advance

christopherfletcher
Автор

For latest redux lib need to use
const thunkMiddleware = require("redux-thunk").thunk;
instead of const thunkMiddleware = require("redux-thunk")

chanduramnaidukodavatikant
Автор

awesome @Vishwas Gopinath. please make a video on redux-saga also

rajnandanibhawsar
Автор

TypeError: middleware is not a function

I am getting above error , below is the package.json file

{
"dependencies": {
"axios": "^1.6.3",
"i": "^0.3.7",
"immer": "^10.0.3",
"react-redux": "^9.0.4",
"redux": "^5.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^3.1.0"
}
}
Please help how to fix the error TypeError: middleware is not a function , I have followed line by line on this article.

samirbalabantaray
Автор

People are so lost watching these (well organized and beautifully explained) videos that they forget to "LIKE It!"

skauddy
Автор

createStore is deprecated the middeWare won't work anymore

rezaastaraky