Optimizing Performance of React Context

preview_player
Показать описание
In this React Context tutorial, we're gonna try to optimize our Context and avoid rerendering the components on every Context value update.

Consider supporting the channel by clicking the "Thanks" button ❤️

📚 Resources:

And don't forget to subscribe for more videos like this 😊

#react
Рекомендации по теме
Комментарии
Автор

No way a channel like this has only 4k, keep up my man, I see you in 100k soon ❤

hamidhamri
Автор

What if its object i mean when i use usereducer and state is in object at i want to pass state directly os there any good way

numericalwallah
Автор

Then it's very useful if we use useCallback for functions inside my provider and also useMemo for the provided values?

DiogoLScarmagnani
Автор

Sir, i believe your LinkedIn link doesn't work anymore so could you please update me with that, Thank you

GrowthBhavsec
Автор

All the devs who works in my team. I ask them to divide the component into very small chunks.

code_react
Автор

Why not just import signals from preact… obviously it would be better if that were built in.

jonathangamble
Автор

the memo on children is unnecessary. ur right that useMemo on the value passed to the context is one issue bu another issue is that u have a state in the app that updates when u click update session, therefore rerendering all components displayed there. if u remove the context all together, u will still see the children rerendering even if they dont have memo.

In this scenario, u shouldnt have a state in the app that is passed to the parent, the session id shouldnt be in the parent to avoid rerendering mistake #1
if u do that, u shouldnt need to memoize the children. I think..

nataneldemissew
Автор

Your explanation is incorrect. It’s got nothing to do with the currentUserId state variable being different on each render. It because you are creating a new object out of it on each render.

asiraky