Redux Toolkit Tutorial - 24 - Async Thunks

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ม.ค. 2025

ความคิดเห็น • 78

  • @NaimulIslamArif
    @NaimulIslamArif 2 ปีที่แล้ว +13

    Im loving your way of explaining things step by step on a level that can everyone understands no matter its a beginner or pro.
    Thanks a TON, Man

  • @ganeshkhirwadkar4127
    @ganeshkhirwadkar4127 5 หลายเดือนก่อน

    A good teacher or say mentor is the one who teaches or explains the complex concepts in such a way which makes it easy to grasp and remember. You are on of those mentors !
    Thanks and lots of Blessings

  • @monarchgam3r
    @monarchgam3r 2 ปีที่แล้ว +8

    Thanks for all you do for the community

  • @juliefaucher8253
    @juliefaucher8253 2 ปีที่แล้ว +6

    finally understand redux, thank you for your great courses

  • @valp_co
    @valp_co ปีที่แล้ว +1

    This kind of video are really useful, all we know official Docs still already there, accesible and updated...obviously that's the source of truth. Even though the way your drop explanations, step by step while dropping cons and pro about every single detail, it just really rocks.
    Congrats Vishwas, because your teaching skills are just amazing.

  • @mihokeys283
    @mihokeys283 2 ปีที่แล้ว +4

    The magic of createAsyncThunk().

  • @alvinacosta2312
    @alvinacosta2312 2 ปีที่แล้ว +4

    Thank you, Vishwas. Your videos are the best ones here on yt.

  • @dat-ta
    @dat-ta 2 ปีที่แล้ว +4

    You should demonstrate parameter reducers with an empty curly braces as required in createSlice to avoid typescript complaints.

  • @albinjose225
    @albinjose225 ปีที่แล้ว

    Well organized tutorial playlist. THanks a lot for this!

  • @srikanthek737
    @srikanthek737 5 หลายเดือนก่อน

    Great coverage its excellent

  • @m__link6499
    @m__link6499 2 ปีที่แล้ว +3

    Dude, the day you will deal with Solidity (Ethereum smart contract langage)like you usually do with react, I think your account is gonna hit 1 million subscriber...You are just the best in coding in my opinion...Web3 world is going to be huge...thank you for all thing you do...

  • @dfmontesinos
    @dfmontesinos ปีที่แล้ว

    Great explication, thanks you!!

  • @IamPetrus
    @IamPetrus ปีที่แล้ว

    muchas gracias Vishwas!

  • @yashpawar2936
    @yashpawar2936 2 ปีที่แล้ว

    thanks bro very well explained!

  • @leonid1927
    @leonid1927 11 หลายเดือนก่อน

    Great, thanks! What is the name of this color theme?

  • @axerdas6332
    @axerdas6332 2 ปีที่แล้ว

    For anyone wondering if you should use it for "isLoading (boolean)" as it is in this video - don't. Await/then "freezes" your app till it gets response from axios or fetch function, so the isLoading = true is not immediatelly refreshed in the component which uses it, and therefore you end up with loading message popping up on the screen for literally a microsecond. Use case shown in the video is strongly misleading and should be considered as a bug

    • @prerit714
      @prerit714 2 ปีที่แล้ว

      I am working on a project which requires me to use a loading spinner. can you suggest an alternative for the approach shared by vishwas for the fact that you think this approach might be buggy?

  • @monarchgam3r
    @monarchgam3r 2 ปีที่แล้ว

    Wish the videos would come in faster tho, been holding off on starting this series until all videos are uploaded

  • @srikanthek737
    @srikanthek737 5 หลายเดือนก่อน

    I love the way you are teaching, is there a chance you can cover thunkapi and thunkarg
    Quick question, say, if createAsyncThunk and createSlice functions are in 2 different files, if there are n number of features, how we can relate or find which createAsyncThunk callback promise referring to which createSlice which has corresponding extraReducers, sorry if its sounds silly question

  • @auronedgevicks7739
    @auronedgevicks7739 2 ปีที่แล้ว +1

    why does createasyncthunk needs to be added to extrareducers, not just reducers?

    • @scratchacat
      @scratchacat 2 ปีที่แล้ว +1

      because actions are automagically generated by createSlice when you populated its reducer property with functions. these reducer functions of createSlice cant update the state in async mode. so the async function is handled by createAsyncThunk, which also automagically generations actions. These actions generated by createAsyncThunk are external to createSlice. so the only way for createSlice to respond to them is through extrareducers

  • @ast453000
    @ast453000 2 ปีที่แล้ว +1

    How can you export userSlice.reducer when there is no userSlice.reducer? I only see a userSlice.extraReducers.

    • @cdialpha
      @cdialpha 2 ปีที่แล้ว

      Same question 🙋‍♂

    • @ChiiMikaz
      @ChiiMikaz 2 ปีที่แล้ว +2

      the way I understand it, the reducer (and action creator) is automatically created by "createSlice"

  • @noumanahmad2313
    @noumanahmad2313 2 ปีที่แล้ว +8

    Any one else facing problem with payload = undefined??? if so then use Async Await instead of .then and it will work perfectly

    • @orofinadedamola4008
      @orofinadedamola4008 2 ปีที่แล้ว

      Mine still isn't working 😣

    • @ArjunTanwar900
      @ArjunTanwar900 2 ปีที่แล้ว

      what, now why would it work

    • @ArjunTanwar900
      @ArjunTanwar900 2 ปีที่แล้ว

      oh it worked cuz async functions return promises while the function in video returns a number[]

    • @juliefaucher8253
      @juliefaucher8253 2 ปีที่แล้ว +1

      I had this issue because of curly braces in the fetchUsers function : ... .then(res) => res.data.map(user )=> {user.id})
      I removed it and it works : res.data.map(user=> user.id)) . Hope it's clear and helpfull

    • @vantuhuynh2665
      @vantuhuynh2665 2 ปีที่แล้ว

      It resolved at 10:08

  • @levankantara
    @levankantara 2 ปีที่แล้ว

    I am so lost now. I used to create slices in Index,js (store) and export actions. Then just dispatch those actions. This is something different, still trying to see what the heck is going on, is my learning outdated?

  • @prathameshthorat4709
    @prathameshthorat4709 2 ปีที่แล้ว

    Sentences are missing some places in speech.

  • @tiwaritiwari1583
    @tiwaritiwari1583 2 ปีที่แล้ว

    Hello Vishwash ji, How can I dispatch with a query object and handle the object inside slice file(where we are fetching data using)

  • @MarkyMarking
    @MarkyMarking ปีที่แล้ว

    I have question : if im using 3 addCase (fullfilled, pending and rejected), for each request, the code will get too large, any way to refactor it?

  • @harishpatidar8888
    @harishpatidar8888 2 ปีที่แล้ว

    Hey, For one async api request, we have added three addCase function in builder. If I need to delete two more apis, like post and delete users then there will be six more cases in extra reducers functions?

  • @cr7johnChan
    @cr7johnChan 2 ปีที่แล้ว +1

    getting
    error : 'unexpected end of file'

    • @12345charliebrown
      @12345charliebrown 2 ปีที่แล้ว +2

      Encoding issue with Brotli compression axios 1.2.1 either downgrade to an older version or add a custom header in the get function with headers: { 'Accept-Encoding': 'gzip', }

    • @cr7johnChan
      @cr7johnChan 2 ปีที่แล้ว

      @@12345charliebrown thanks

    • @12345charliebrown
      @12345charliebrown 2 ปีที่แล้ว

      @@cr7johnChan 1.2.2 just released now fixed

  • @vzdev9978
    @vzdev9978 2 ปีที่แล้ว

    Good tutorial, its better if using typescript 😐

  • @akshaygadekar3089
    @akshaygadekar3089 2 ปีที่แล้ว

    if we have to handle multiple async requests, how will reducer handle it? make multiple createAsyncThunk?

  • @amirheydari9541
    @amirheydari9541 2 ปีที่แล้ว

    please make video about rtk interceptor

  • @edgarhovsepyan893
    @edgarhovsepyan893 2 ปีที่แล้ว

    Good day! please add lessons for "how to use reduxToolkit with Next js" please, thank you for great work!

  • @mojia4018
    @mojia4018 ปีที่แล้ว

    for anyone facing wierd errors! just delete the logger middleware

  • @varuncharan9109
    @varuncharan9109 2 ปีที่แล้ว

    One doubt is from where the action.payload (without passing any value in dispatch) is fulfilled with user of array in this example

  • @coder_mohmedarab3686
    @coder_mohmedarab3686 2 ปีที่แล้ว +1

    what is difference between this tutorial and old tutorial ?

    • @lohitakshtrehan3270
      @lohitakshtrehan3270 2 ปีที่แล้ว

      exactly :(

    • @paraschawla3757
      @paraschawla3757 2 ปีที่แล้ว +4

      Old tutorial used pure redux & not redux-toolkit to make async action call.
      redux-toolkit is just an abstraction on top of normal redux explained before.

  • @rahulnag9582
    @rahulnag9582 2 ปีที่แล้ว

    how to add multiple action in extra reducer ?

  • @aurobindobhuyan2107
    @aurobindobhuyan2107 11 หลายเดือนก่อน

    How to access getState and getDispatch from createAsyncThunk?

  • @francisfuwaku
    @francisfuwaku ปีที่แล้ว

    i wonder why you didnt import to make the work more easier

  • @ericleung4313
    @ericleung4313 ปีที่แล้ว

    excuse me, but why does the unsubscrible function called?

    • @someonenotlikeyou
      @someonenotlikeyou ปีที่แล้ว

      did u find the answer I have the same question

    • @someonenotlikeyou
      @someonenotlikeyou ปีที่แล้ว +2

      The answer I think It can be when the request is made we changed the state so the subscribe is called and when it is rejected then it called again and logged the state again.
      But i'm not fully sure

  • @pawanupadhayay381
    @pawanupadhayay381 2 ปีที่แล้ว

    Why are you still using require?

    • @sal2054
      @sal2054 ปีที่แล้ว

      node environment

  • @auronedgevicks7739
    @auronedgevicks7739 2 ปีที่แล้ว

    create async thunk fails for me

  • @trieudien1990
    @trieudien1990 2 ปีที่แล้ว

    good🥰

  • @Alex-xe6bl
    @Alex-xe6bl 9 หลายเดือนก่อน

    is unsubscribe really needed to be removed for it to function properly?
    @everyone

  • @mohammadhazim6146
    @mohammadhazim6146 2 ปีที่แล้ว

    rtk query please with pagination data

  • @arcan762
    @arcan762 ปีที่แล้ว +1

    didnt understand a thing, no idea

  • @ISoaw
    @ISoaw 11 หลายเดือนก่อน

    So much boilerplate tho, i think react query does all of that in like 5 lines of code.

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 ปีที่แล้ว

    Awesome +++++++++++++++++ 😃

  • @KusumaDhanush
    @KusumaDhanush ปีที่แล้ว

    React tool kit with redux saga can you please playlist

  • @abdulahnaser6292
    @abdulahnaser6292 2 ปีที่แล้ว

    Can you do lessons on chat and calls like WhatsApp, please

  • @Ahmed-fq3kz
    @Ahmed-fq3kz ปีที่แล้ว

    The video isn't clear enough, but good job overall.

  • @tmahesh3607
    @tmahesh3607 2 ปีที่แล้ว +1

    Hi vishwas why don't you show us async thunk fetching data by using useSelector and useDispatch hooks ! In ur react redux also u used this scenario only ! I hope u make a video on async fetching data by using hooks

  • @amacodes7347
    @amacodes7347 2 ปีที่แล้ว

    Thanks very much for this great video. I don't know if anyone has encounter this problem store.dispatch(fetchUsers())
    ^
    TypeError: fetchUsers is not a function. I downgraded to a v1.6.1 as suggested in a github pull request issue. But it doesn't seem to solve the problem and I'm using the LS version. Let me know if you have a solution.

    • @apuemdad2070
      @apuemdad2070 2 ปีที่แล้ว

      I think you should check your import if it's correct or not

    • @issackhant
      @issackhant ปีที่แล้ว

      I have this issue did you solve it?

  • @AhmedKhan-rt6oz
    @AhmedKhan-rt6oz 11 หลายเดือนก่อน

    The redux tool kit is not good defined by you.

    • @chukwuemekamusic663
      @chukwuemekamusic663 11 หลายเดือนก่อน

      It is a series of amazing lectures… so I can understand the frustration if this is your first lesson

  • @sjljc2019
    @sjljc2019 2 ปีที่แล้ว

    In the axios when I use
    .then((res) => {
    res.data.map((user) => user.id)
    });
    I get the users as undefined as output. But when I use .then(res => res.data.map((user) => user.id)); I get the correct result as the ids. Can anyone help me understand this issue. I am very new to JS ecosystem.

    • @spoiler3537
      @spoiler3537 2 ปีที่แล้ว +7

      you have to use return keyword .
      ()=>{
      return something
      }
      But if you do .
      ()=> something
      It under the hood returning something but we can avoid return keyword as we are returning just one thing

  • @utkarshdubey2433
    @utkarshdubey2433 2 ปีที่แล้ว +1

    so confusing take another course i recommended 😑😑