What is a JavaScript Reducer Function???

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • 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.co...

Комментарии • 21

  • @ambermullen8285
    @ambermullen8285 11 месяцев назад +2

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

  • @georga.9236
    @georga.9236 3 года назад +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 Год назад

    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).......

  • @avinashgardasalgonquin4371
    @avinashgardasalgonquin4371 3 года назад +1

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

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад

      Sorry you are going to miss out on all the cool web dev stuff that we do.

    • @avinashgardasalgonquin4371
      @avinashgardasalgonquin4371 3 года назад

      @@SteveGriffith-Prof3ssorSt3v3 I was afraid I'd miss all the fun part of web dev :( it does hurt. By any chance can I change my course in the winter intake?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад

      @@avinashgardasalgonquin4371 we don't have a winter intake, only Fall.

  • @dfgndfghdfghdfgh
    @dfgndfghdfghdfgh 3 года назад

    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.

  • @kllokoq
    @kllokoq 3 года назад +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  3 года назад +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 3 года назад +1

      Thank you Steve!

    • @avinashgardasalgonquin4371
      @avinashgardasalgonquin4371 3 года назад +1

      @@SteveGriffith-Prof3ssorSt3v3 yes Steve!

  • @Rocky-qd1sp
    @Rocky-qd1sp 2 года назад

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

  • @falanges5301
    @falanges5301 Год назад

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

  • @RogerThat902
    @RogerThat902 3 года назад +2

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

  • @michaelcuccia470
    @michaelcuccia470 3 года назад +1

    This is a great explanation!

  • @darshancj483
    @darshancj483 Год назад

    The tactical turtleneck!

  • @HarshKapadia
    @HarshKapadia 3 года назад +1

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

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 года назад +2

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

    • @HarshKapadia
      @HarshKapadia 3 года назад +1

      @@SteveGriffith-Prof3ssorSt3v3 makes sense. Thank you!

  • @systemmanager186
    @systemmanager186 2 года назад

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