Learn useReducer with Typescript + React Hooks

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

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

  • @ichiroutakashima4503
    @ichiroutakashima4503 2 года назад +11

    Hey, Dave. I've found your channel through Free Code Camp and I really have to thank you because I've learned a lot through your channel especially on hard topics like recursions, Callbacks and closures.
    I really appreciate your time making these videos and I hope you could hear my request.
    I would like to request your time to make some content regarding JavaScript Unit Testing with Jest. There really isn't that much content and most content around it seems to be only focused on React but not on JavaScript itself.
    I hope you'll hear me out. Thanks.

  • @7doors847
    @7doors847 2 года назад

    🔥Congratulations on the 💯k Subs! 🙌 (Well deserved IMO)
    Wishing everybody happy holidays 🎄

  • @Salah-YT
    @Salah-YT 2 года назад +1

    thank u so much hope you have a great year 2023 and happy new year 🙂

  • @mickmister
    @mickmister Год назад +7

    Instead of doing `payload ?? ''`, what do you think about using explicit types for each action? Something like:
    type NewInputAction = {
    type: NEW_INPUT,
    payload: string,
    }
    type IncrementAction = {
    type: INCREMENT,
    }
    type ReducerAction = NewInputAction | IncrementAction
    const reducer = (state: ReducerState, action: ReducerAction) => {
    That way you can keep honest the actions coming in, and ensure that the proper payload is being provided for each action type.
    Also, I've used Redux but I actually haven't used useReducer before. It seems like it may be a good solution to handle form data with several fields? I wonder how to properly typescript that use case.

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

    I can understand it clearly. Thank you Dave!

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

    I really enjoyed this tutorial, thank you Dave, excellent content.

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

    You always put great content 😮

  • @shivamvijaywargi
    @shivamvijaywargi 2 года назад +4

    Can't wait to see what GEM💎 you'll have for us next.

  • @aaymankhalid9997
    @aaymankhalid9997 Год назад +1

    hey @Dave Gray,trying to understand the useReducer hook. but I am getting stuck at the type ChildrenType = {children : (num : number) => ReactNode}. is this a function? Why do we need it ?

  • @beeboylinux7524
    @beeboylinux7524 2 года назад +2

    Hey Dave. Good job 👌. You're the best .

  • @abdulazeez.98
    @abdulazeez.98 2 года назад +4

    Awesome video as always 👍
    Typescript is awesome on the frontend. Recently I have been learning to implement it on the backend. But it doesn’t have that much support (especially with ORMs).

  • @MOJICA7257
    @MOJICA7257 2 года назад +1

    Thanks Dave, Good Job as always :)

  • @TheOneHong
    @TheOneHong 2 года назад +1

    Can’t wait for context, need that for my project

  • @wahidulislam-dl5cv
    @wahidulislam-dl5cv 7 месяцев назад

    very useful and clearly understandable . thanks 👍

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

    Great content! Thank you, Dave!

  • @TravinskiyVladislav
    @TravinskiyVladislav 2 года назад +1

    Thank you, Dave

  • @dzhaniivanov5837
    @dzhaniivanov5837 2 года назад +1

    i don't find starter code u have branch only with finished ?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 года назад +1

      The link in the description goes to course resources. The starter code is the code from the previous chapter. I _think_ I said this in the video, but apologies if I did not.

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

    Great tutorial. Is there any particular reason why you create the Reducer Action Types in all caps? Is it just for us viewers to understand it better and have a better visual representation? Or is it somewhat related to good coding practice?

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

      It's more to do with coding practice. I do mainly C# and would type the enum out as normal PascalCase, yet other devs on the team prefer that horrible shouty capitals. I personally hate it as it detracts from the rest of the code on the page. I do see it in caps more by those that do javascript these days., but it's really up to you on which way you like, especially of you're solo and not in a team.

  • @LeonardoSeptianDwigantoro
    @LeonardoSeptianDwigantoro 2 года назад +1

    hi, awesome video! btw what theme do you use for your vs code?? thank you

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

    Hello do you know a y good tutorial or resources too help me with VS code it's really slowing me down

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

      Yes, here is a link to the best VS Code course I know of: bit.ly/3SYKcwE

  • @Grishopping
    @Grishopping 2 года назад +1

    Gracias Dave

  • @surajambekar6324
    @surajambekar6324 2 года назад +1

    Hello sir, I am learning MERN stack using free youtube content. I am about to complete my front-end part and I was thinking after doing front-end I will start finding internship but there is one problem or opportunity I can say that my college has conducted a workshop so there is one company who is gonna give us internship for 6 moths on Node js. So my question is could please give me an advise that should i take this opportunity or after completing front-end I should apply for front-end?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 года назад +2

      Sounds like a great opportunity to gain some real experience! Also, Node.js is still JavaScript so you will continue to improve many skills that can translate back to frontend in the future. 💯

    • @surajambekar6324
      @surajambekar6324 2 года назад +1

      @@DaveGrayTeachesCode Thank you sir, so I will take this opportunity. Thank you for teaching us.😇

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

    Great video, thanks. I'm getting use to react and the other hooks so trying to sink my teeth into the useReducer. I've been given a project a work which I'm taking over from some contract workers they have had, and it's a mess. then basically have one component and define 100's of useState and pass them down to each component, about 20 to each, depending on the area of the application. this reducer stuff would have made it look nicer and more manageable. Thanks for sharing this, it will be very useful.

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

    One thing I don't understand: the general advice is use Context with a grain of salt, only if necessary, and don't abuse it. One the other hand, the general advice is use reducers instead of state, and of course, put them inside context. So, which is right? What is good practice here?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  Год назад +1

      As you said, it is all general advice that you have read. I can't comment on their advice - whoever it is - but my general thoughts: 1) If your state is really simple, just useState. 2) Ok, your app is getting bigger - now a reducer and context might make sense.

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

      @@DaveGrayTeachesCode Thanks for tip, Dave. I guess my confusion is, in the context (ha!) of a reducer, it is OK to use context. At least, that's the conclusion I'm able to draw.

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

    Hey Dave. There is no starter code for this lesson, both in lesson 13, 14 and 15. You should probably structure you files as lesson 1 - starter and finished and so on. This is what I have seen most online and is less confusing to work with.

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

      Sometimes I do, but often I just provide the finished code. You can start a new project from scratch fairly easily.

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

    thank you sir

  • @me-wtf
    @me-wtf 2 года назад

    Can you please make basic to advanced level git and GitHub Tutorials!

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

    Dave! I couldn join you in discord cause I live in IRI and as you know maybe our Internet services is horrible.
    I need your consultant tooo much,

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 года назад +1

      Sorry to hear that! Ask questions on a video if you cannot join Discord, but sometimes RUclips hides comments and questions and I don't see them.

  • @willyhorizont8672
    @willyhorizont8672 2 года назад +1

    🚀🚀🚀🚀

  • @ubtonai.online7988
    @ubtonai.online7988 2 года назад

    Please course React with javascript

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

      React is JavaScript. If you look on my channel page you will find courses on React and JavaScript. 👀

    • @ubtonai.online7988
      @ubtonai.online7988 2 года назад

      @@DaveGrayTeachesCode i think your react course not for beginners. React zero to hero full course. Thanks. Your tech technology wonderful

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 года назад +1

      @@ubtonai.online7988 it is for React beginners, but you should learn HTML, CSS, and JavaScript before React. I have courses on my channel for all of these.

    • @ubtonai.online7988
      @ubtonai.online7988 2 года назад

      @@DaveGrayTeachesCode Thank you

  • @msahu2595
    @msahu2595 2 месяца назад

    💓