React – 16 – Context and Same Element Reference
![*](https://i0.wp.com/allprowebdesigns.com/wp-content/uploads/2024/01/1705021242_maxresdefault.jpg?resize=840%2C430&ssl=1)
Video Title: React – 16 – Context and Same Element Reference
Welcome back everyone in this video let’s look at another way to optimize the context rendering behavior in react now this again is a technique we have already seen when trying to optimize parent child rendering and that is the same element reference technique i’m going to make changes in the code
We’ve already written and then explain how it works in the context parent component i’m going to delete the memoized child a component instead i’m going to destructure children from the component props and specify the same as children to the context provider so within the count provider children
Is going to be the children props back in app.js we have to slightly modify the context parent invocation instead of the self-closing tag we now have opening and closing tags and as children to this component we’re going to specify the child a component make sure to import it at the top let’s
Save all the files and test this out in the browser on page load we have the log messages from all the four components corresponding to the initial render if i clear the console and click on the count button you can see that only the parent and the child c components
Re-render the rendering behavior is optimized to the way we want it to behave the count value is also reflected properly in parent and child c components let’s quickly understand what is happening here when the setup function is called in the parent component react cues a re-render of the component
However react knows that vendor is caused by a state change the component also cannot modify its own props which means the children crop could not have been modified what is the children prop it’s the child a component so react now knows that child a hasn’t been modified
And there is no need to re-render that component this is an optimization react automatically takes care of as react goes down the component tree it will we render just the child c component as it consumes a context value whose value has been changed so if you’re using context in your react application
Either make sure to wrap the immediate child of the context provider with react memo or make sure to use the children props to make use of the same element reference optimization that react provides all right with that we come to the end of the series about react and the rendering behavior in react
I hope you enjoyed finding out the smaller details in react as much as i did if you found this series helpful please leave a like and share the playlist with your friends and colleagues if you would like to go the extra mile you can also support me
On patreon thank you guys for watching don’t forget to subscribe and until next time take care
-
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
hello sir u r saying one point like "when the setter function is called in parent component react then ? a re-render of the component. what is that word marked as ? " and what does that mean?
useRef is not discussed, as it has nothing to do with re-rendering!
Vishwas once said: (in React playlist)
– useRef – can be used to create a generic container, which can hold a mutable value similar to instance properties on a class component. This generic container does not cause re-renders, when the data it stores changes, at the same time, it remembers the stored data even after other state variables caused a re-render of the component.
really nice playlist, thank you so much
Definitely found this helpful, thanks
Really helpful. Thank you.
THANK YOU SO MUCH SIR
You are really amazing. All of the series are great. I really appreciate all of your videos and how you explained them well. Thank you!
Thank you so much for this playlist!
learning new thinks ….. love from bangladesh
I really enjoyed the series
Thank you so much Vishwas. I wish you to be healthy and successful as you goes on with your career and life. No paid course can match your ReactJs course. Thanks for your time and efforts.
Done with React Render-. Never thought Rendering has such much to do with different scenarios. Thoroughly enjoyed this series. Thanks Vishwas ❤️🎁
Heading to Practical React ✅✅🏃🏃
Just finished this series. BRAVO! Thank You! This knowledge will save a LOT of time. Now I'm wondering if there is a "React Cookbook" with "recipies" that provide all of this information as succinctly and clearly as Vishwas has provided it here. We need to find a way for individual developers to help fund Vishwas for all of this work that he has done for us.
Great Resource on React rendering and re-rending.
Loved every second of this React Render Playlist. Got to learn a lot
This tutorial is a good refresher 😍 Thank you @Codevolution
Brilliant!
very helpful and very nice
Thanks!
♥
Awesome
Another superb tutorial. Thanks!😁
Thank…..Well explained
Thank you for the series!
What a great learning experiance it was. Perfectly structured to give an deep insight of react rendering. Hats off ♥️
Awesome explanation 👍
That was an excellent series. Thank you, my friend!
i love you brother u made it too easy
keep making this type of things
also make vedios on react interview
javascript interviews
Nice Course
Thanks for Solid Understanding
Thanks for the wonderful lecture.
Quality content. better than paid Udemy courses
This is arguably one of the best react content I have watched. Very few dive deep into react render process and I'm glad I found this series. Hats off to you Sir! Every series you make is worth watching for anyone at any level.
Sir, firstly thankyou so much for these wonderful series. My humble request to you, if you could please make some videos on React Dev Tools also.
Thank you so much for your time to share your experiences and knowledge to us i watched each and every videos it's simply awesome and it's very easy to understand 👌🏼👌🏼👌🏼👌🏼😊🙏🏼
I learn many new things. Thanks for the amazing tutorial !!!
Great Videos. Very clear and concise. Can you make a video series for Mobx state management library as well.
Thank you sirr God Bless
Thank you so much Vishwas! Keep up the great work
Thank you for great content
💜
Thanks so much we have been together on this journey let me end here i am not going to use typescript for react thanks very much
One of the greatest teachers!