@oliverweiss7175

Thanks for the video! I have some remarks: 


createRef creates a new Reference on every render (because it is a functional component everything is executed again, while in class components you can have fields, which store values over multiple renders). And useRef is probably getting around this problem by internally keeping track of the refs and reusing it again. If you would use createRef, you would get a null reference every render, if you would access the ref.current object immediatly after creation (except if you use the ref in useEffect). With useRef you would only get a null reference on the first render (because the JSX has not been executed, there is no reference bound yet). But the second render would have the reference. I generally use the useRef hook and access it only in useEffect function (because it is executed after the render, so the reference will definelty be established). 

By the way: In your useMemo function you can also pass the function like this: useMemo(printNumberOfPeople, []). There is no need to wrap the function in a function again.

@kadekeqw23

My understanding as a novice is as follows (please correct me or provide elaboration)


useState - state management
useReducer - more complicated state logic
useRef - same as createRef
useEffect - similar to componentDidMount a.k.a when the component is loaded on the page
useMemo - when the component is updated

@redraushan

Woah, clear and to the point :)

@srttkx

All your vidoes are awesome!!!!! Thanks

@srinivasaeranki2778

For the useMemo hook, I get "Number of people: 2" printing out twice and the same thing for each and every addition. Could someone explain to me why this is happening?

@FajarJunior

what the model of keyboard or switch  you using .. i like the sound

@MrDV112

Can somebody explain why I get this ?

React Hook useMemo has a missing dependency: 'printNumberOfPeople'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

@yadusolparterre

I still don't see the difference between useRef and useMemo

@oracleking4252

Dude. Where did you get the context from? As in "context.people.length