React Hooks Tutorial – 17 – useContext Hook Part 3
- January 1, 2024
- Posted by: MainInstructor
- Category: React
Video Title: React Hooks Tutorial – 17 – useContext Hook Part 3
All right everyone it’s time to finally learn how to use the context hook in react in the previous video we saw three steps to creating and consuming a context value step one we created a context using the create context method step two we provide the context value at a high level in the
Component tree step three we consume the context value using the render props pattern now let’s see how to do the same with use context now as it turns out the first two steps of creating a context and providing a context value remain the same the u.s. context hook only makes
The consumption of the context value simpler let’s see how for use context let’s consume the value in component II there are three simple steps to consume the context value the first step is to import use context from react second step import the necessary context we have two of them so let’s import them
Both user context and channel context the final step called the use context function passing in the context as its argument use context user context and use context channel context the use context returns the context value let’s assign the function call to a variable Const user is equal to use context user
Context Const channel is equal to use context channel context and that is said we can now use this values as required I will simply render them in the JSX user and channel if you now take a look at the browser we should be seeing the expected output and that’s all there is
To the context hook now some of you might feel this was an elaborate explanation for a simple concept but I felt that you can only appreciate how much use context simplifies context consumption when you have seen first hand have the code used to be before the introduction of hooks I would say this
Is probably the simplest hope to use so any opportunity you get definitely give this a try well that is about use context thank you guys for watching don’t really subscribe and I’ll see you guys in the next video
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Awesome explanation. Thanks Vishwas
What about changing state with it ?
Concept is clear of useContext as it is used to pass props to the lower most children component from the root or app.js without passing through the middle components. That's it.
What I think about the concept is just to know the concept and the most needed ability you must able to find It from browsing. That's it!!!
Great explanation. It just feels like using GetX and sharedPreference to pass data (in flutter). You just made it clear for me thank you!
The way you covered everything, is simply brilliant
Is it required to create context at App component or can we create in any component of our choice?
Woah man! Super explanation
Probably the best channel for development, thanks vishwas for your efforts. Great work man!! HUge respect
thanks Codevolution
you should be honored
Thanks a lot for explanation.
Thanks vishwas, your explanation is clean and presise
thanks you so much ! You delivery every thing so simple! You are a legend!!!!!!
Here is code evolution sharing and teaching us all on YT and then there are others who are calling and emailing me for selling their react courses for 20000 rupees 😂
Superb explanation vishwas.
wow!
It is a wise idea to explain the why part first before the how part.. you are a genius!! Keep rocking 🙂
I love this guy. Top tier tutorial videos. Keep it up, Vishwas!
60
Your explanation is amazing, as i am new to React , I able to understand every detail of code you write. as I no need to refer again in Google or any other youtube channel. 😍😍🤩
Simple and to the point. No non-sense. Thanks a million.
koii complete E-comerece site ya crud ya koii choti moti application bna doo bhaii
legit shocked at how easy and lucid the code is compared to the previous vid….amazing course!
Thanks.
1. React.createContex
2. <urContext.Provider>
2. <urContext.Consumer>
to overcome nesting – we have useContext – on consumer side:
1 & 2 are same, only consuming part is different.
This is amazing content. Thank you very much. Much Appreciated.
Only an experienced trainer can teach like this ❤️ Great tutorial 👏🏻
Thank you Vishwas for your simple explanation of React lessons, I really appreciate your efforts to help us with these information.
Excelent explanation. I would like to know if Context is the same that Redux?
You are an Amazing! teacher.
Oh my god
I didn't expect that.
You tought that the simplest way.
I was watching all videos of teaching it.
But never understand.
Thank you a million 💓💓💓💓
Thank you so much
thanks for those videos.
good job