Mastering React Context 2023: The Complete Guide!

preview_player
Показать описание
React Context is a critical concept to master once your projects get to a certain size. Context can drastically improve your code readability, help you avoid prop-drilling (passing props down through lots of components), and increase code maintainability.

0:00 Why learn React Context?
0:20 Overview: When and how to use context
5:56 Example project: Properly implementing context

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

Really cool video! I use context a lot of times in my apps. If I could add a little something: I usually like to add a hook that goes with my Context Provider. An example here would be to export a useTheme method that returns useContext(ThemeProvider). It is not game changing but it adds a little bit of simplicity in the consumer code. 😊

Douwab
Автор

I was wrong about Context. Thanks Josh !

codewithguillaume
Автор

Hey Josh, It’s been a blessing to discover your youtube channel, I have learned so much from your recent videos.
You mentioned that you do/did freelance, do you have any tips for how to get into that sort of work as a beginner? (I am based in Germany if that helps)

MultiReylords
Автор

Context is ultimately a complicated (sophisticated ?) way to use global variables or objects ...
Thanks for the good teaching.

angladephil
Автор

Why setThemeValue in ThemeContext is empty and you add logic inside PageContent?
Is it typical approach?

sewerynwozniak
Автор

nice video, very informative and at the same time very helpful :)) What app do you use also to draw?

oncoding
Автор

I used context-selector-api because useContext had rerendering problems

samoniumuziejus
Автор

Hi man a quick question that i really need to know, are providers exposed to a child that didn't export it?

Let's say i passed password context to the root component

Will user will be able to see password from the footer using some kind of trick from the browser? Though i didn't import the password from footer

blazi_
Автор

Good example of how typescript can make things much more complicated
Really it was introduced to make coding easier and for me it's most time-consuming part of coding in react

sewerynwozniak
Автор

Why doing this classic way since we have things like Redux, Recoil, etc...? Whats the pros?

emigrek
Автор

What is the root component for next 13 applications?

faiquejatu
Автор

In "2023"??? It's literally the same thing as it has always been years prior.

gbeh