Context vs Redux: What to Choose? - Experts Zone #6 | frontendhouse.com
Вставка
- Опубліковано 31 лип 2024
- When should you use Redux and when Context will be the best option? Find out in the podcast by Piotr Czubak. Check the contents 👇 We can help your company with development issues: contact us via form on frontendhouse.com/.
0:00 - Intro
0:34 - Agenda
0:50 - What is the application state?
1:05 - Passing props through components
1:50 Tools to manage application state: Context API and Redux
5:18 - Advantages of Context
5:47 - Advantages of Redux
6:13 - Which one should you choose?
Have a nice watch! Don’t forget to like the video and leave comments to share your impressions! ⚡
Prefer reading? Check the transcription on our website frontendhouse.com/experts-zon... - Наука та технологія
To summarize: Whenever a Context provider's state changes, Context will cause a re-render to all the components (parent or child) consuming that context (which CANNOT be controlled). This is exactly the behaviour expected when prop-drilling is done. On the other hand, Redux will cause (dispatch) re-render to only those components which are ingesting a certain value (selector) from the store.
[ A caveat to this is that the same behaviour of Redux can be induced into Context as well, by having different contexts (ProContext and ConContext). You would have to manually write different contexts, so that one context's state change would not cause re-render to a component consuming a different context. Redux does the same out-of-the-box]
TLDR: Is the project big and state is ever changing ? Use Redux : Use Context
nice lol
haha thanks
after 2 months using usecontext i just realized the everything re-render stuff, well you cannot notice any performance change if your app is simple and rarely use states, but for a big app this is a serious matter
Amazing tutorial, short and sweet. What I wanted. Thanks my friend :)
incredibly easy explanation, probably the best one I've seen
Great delivery! Thank you Piotr!
Thank you understand clearly!!
Solid video, needed the comparison. You should increase the videos size and reduce the size of your face cause thhe code font was small.
Thank you! You're right, we will make the font bigger. Do you have any ideas on what comparisons we have to do next? :)
Nice bit of knowledge for newcomers, great delivery
Thank you!
Can't we just use useMemo with Context API and prevent unnecessary renders as well?
When the child/consumer component is subscribed to a context, it doesn't matter if it only consumes one state or several, any change in any state of the context re-renders the component even using memo. Anyway, we can configure memo in a better way using the second parameter that it accepts but everything becomes more complicated and we have to do memo maintenance... When we use redux + memo the component only re-rendered when a specific state that we are consuming changes... and memo does not need more configuration.
It would be nice to have the screen just bigger - hard to see
Really informative stuff 👏
thank you!
Thank you very much, please increase your font size on the tutorials.
Noticed! Thank you for your feedback
sorry, 4k and you can't see the text. terrible
Don't add background music when speaking bro
Should definitely work on talking to the camera just not reading off a script. It was really jarring. Otherwise good video.
Your intro is half the size of your video ... thumbs down ...
You're right, we have to shorten the intro 👍👍
Too much lipsmacking...