What is a JavaScript Reducer Function???

Sdílet
Vložit
  • čas přidán 1. 09. 2021
  • If you have started to learn about state management with JavaScript then you have likely heard about reducer functions. This video explains the concepts behind reducer functions with a couple simple examples.
    Code from video: gist.github.com/prof3ssorSt3v...

Komentáře • 23

  • @ambermullen8285
    @ambermullen8285 Před 8 měsíci +1

    The Archer reference was.... chef's kiss! Thanks for the tutorial!!

  • @georga.9236
    @georga.9236 Před 2 lety +2

    Steve, as a new subscriber I wanna say a big thank you! I have watched quite a few of your videos and the explanation's always stellar! Keep on rocking

  • @kedarpethe
    @kedarpethe Před rokem

    best way to explain this concept!!!! Redux becomes a piece of cake !! Your friendly way of explaining complex concepts is magical!!!
    ..Although, for the benefit of the readers... i want to point out that....
    ....
    The simplest way to understand a reducer is to think of reducer operation flow as unidirectional.... they just go 1 way from left to right.... reducing --> reducing more --> reducing more more -> reducing more more more .... how to reduce them is decided by actions (i.e.- strategy).......

  • @falanges5301
    @falanges5301 Před rokem

    Thanks for your comprehensive explaination about this topic Steve, you are amazing

  • @dfgndfghdfghdfgh
    @dfgndfghdfghdfgh Před 2 lety

    I go to your videos over videos by people like mosh or Cs dojo now. Not to say they aren't great teachers but I find your manner of casual explanation and example to be more understandable. Thank you.

  • @Rocky-qd1sp
    @Rocky-qd1sp Před 2 lety

    Thank you so much. The video i watched before yours didn't help me a lot. Your video gave me a crystal clear explanation

  • @avinashgardasalgonquin4371

    I'd like to join Mobile app dev course prof. Steve, but right now I'm into Web dev course. Neat explanation of Reducer!

  • @RogerThat902
    @RogerThat902 Před 2 lety +2

    This video should be required to explain the basic concepts Redux uses.

  • @kllokoq
    @kllokoq Před 2 lety +1

    Perfect! This explains the concept with vanilla Javascript. So good to know the basics from where the concept originates. Thank you!
    We can now manage state in simple apps that need it, but don't need the whole React library I guess!

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Před 2 lety +2

      It's Redux that you don't need when you manage your own state.
      With the new Context API plus the useState and useEffect hooks you can do most of what Redux was doing.
      Redux was always something that you needed for larger solutions anyway. Simple sites worked fine with setState and passing props.
      React is the virtual DOM part that creates views. With react-dom you render to the browser and react native lets you render your views as actual native components. You could, if you want, build your own virtual DOM with vanilla JS... then you need the code to compare and watch for changes (the harder part to do efficiently).

    • @kllokoq
      @kllokoq Před 2 lety +1

      Thank you Steve!

    • @avinashgardasalgonquin4371
      @avinashgardasalgonquin4371 Před 2 lety +1

      @@SteveGriffith-Prof3ssorSt3v3 yes Steve!

  • @michaelcuccia470
    @michaelcuccia470 Před 2 lety +1

    This is a great explanation!

  • @darshancj483
    @darshancj483 Před rokem

    The tactical turtleneck!

  • @systemmanager186
    @systemmanager186 Před 2 lety

    pretty comment in React went dealing with complex state or working with Redux

  • @HarshKapadia
    @HarshKapadia Před 2 lety +1

    Really nice video!
    BTW, why are these functions called 'reducers'?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  Před 2 lety +2

      They reduce the old state, the action, plus potential new values into a single new state value.

    • @HarshKapadia
      @HarshKapadia Před 2 lety +1

      @@SteveGriffith-Prof3ssorSt3v3 makes sense. Thank you!

  • @MarkKozel
    @MarkKozel Před 2 lety

    This is not a built-in JS capability, but a pattern...is that correct?