I've realy never seen any one who explains React hooks so well and all it's possible uses as well as what mistakes to avoid, This kind of knowledge is really what we are missing as junior developers, And i realy appreciate the effort man Thanks !
Not sure why its easier to understand your way of explanation but it definitely is. Probably it's about voice - you are very calm and well paced. Like Neagoie is overly ecstatic, Schwarzmuller is explaining like he is a drill sergeant in the army, Fireship takes an entire 3.7 seconds to explain even the most complex topic. You, meanwhile, keep the consistent pace.
Probably one of the best explanations I've seen on React Hooks. What i particularly like is the structure of the video: 1) Introducing the hook and it's use cases in short 2) Explain alternative methods (useState) that are easy to use , although can be made better (useReducer) 3) Start with an easy example and structure of Syntax 4) Progress to more advanced example The pace is perfect and explanations are top-tier. Really liked how you built in a useRef example as well, as this is something that junior devs can have a similar feeling around when it comes to use it compared to e.g useState and handleChange for a specific input-field. 10/10.
Daaamn, exactly what I was looking for, I have a job interview in 5 days and this is going to help me a lot with the app I have to create. Thanks for sharing this with us Lama.
U said it and u did it . "If u have playlist u will definitely save this video there and yus i did ." One of the best video ever for usereducer hook ❤️❤️❤️❤️ thanks . Pls keep making such small videos by taking these important topics .
This is very helpful. It's one thing to explain it, but the way he shows visually where things go with his cursor how things are connected, and it goes from here to there. Even gives a little flow chart and uses an example that I'm used to seeing with useState and then shows it's similiarty on how it's done with useReducer and cleans up the code. All around Great stuff the video was short too. 👍
grats bro, your explanation was so well. I just started to work in my job with context accompanied by useReducer and typescript and i had been so confused principally because i hadn't had experience with this hook so far. But this video lit me up like the morning lights. Thanks so much i appreciate your effort doing this kind of videos :)
This tutorial is really great! I appreciate the extra effort showing process diagram and explanation on each parameters&arguments which actually help to better understand. thanks a lot
Great video, useReducer is a good way to exclude and manage well the logic of a components, for performance reasons i think that your ADD_TAG function should send all tags and not 1 by 1 but works well like this too :)
the best thing to do for complex topics is show how a particular that thing can be used in real world. Even if as a watcher I don't understand the whole thing but I know places where it needs to used so that I can try to use them there right away in my projects and It helps to better under stand them.
I love it how you explain the concept and give an example, everythings clear.. Have u ever made tutorial about useEffect clean up function? I thinks its bit complicated to understand by reading on the documentation.. Thankyou so much!
If anyone is keen for a shorthand version of a useReducer, you can do something like this: const [state, dispatch] = useReducer((state, nextState) => { return {state, ...nextState} }, initState) // you still need to have initial state/default values for the reducer's state dispatch({ property_key_to_update: new_value }) // to update a value in the state, use dispatch
omg, this video contains incredible explanation of that hook for beginners. It would have been so nice of you, if you could also do such explanation of useContext and maybe few more🔥🔥🔥👍👍👍
Hello Lama, thanks for the video. Am I correct that the advantage of useReducer over useState is in the reducer function, not the single state? the number of states does not reduce, we just wrap it in an object and it is actually more difficult to change a signle state. But if we use useState, the functions to change states needs to be inside the component, and makes the component really long. When we could import the reducer function, we could seperate the complex logic from the component.
The idea of updating multiple states using useReducer is no longer true in React 18. As of React 18, state changes in side effects are batch updated. So, if you updated multiple states, from a response to another change in state using multiple state updates are batched. The best use case for useReducer, at this point, is complex data structures.
A really good use case is to provide global states through Context Providers and custom hooks. This is best done using a useReducer hook whose dispatch function is the value of the context provider in the custom hook. Super useful, and possibly the only way to do it. Can't do it with useState. Actually, that's the only reason we import useReducer in our projects. We don't import it for anything else. Other than that, and complex data structures as you mentioned, this is actually overly complex for what can be done with three lines of state variables created with useState. Sometimes it can be justified, when you're able to logically group state updates into actions. But mostly it's not really useful to replace a bunch of useState with one useReducer just because you can. It makes code unnecessarily harder to read.
The tutorial is awesome and useful. Could you also suggest a way for state control and faster rendering a table with thousands of rows where the table cells are all text inputs without pagination? Thanks :)