Context in React. useContext and nested Context.Provider

Published: 22 April 2023
on channel: senior_zone
6,386
260

Let's explore what prop drilling is and how to fix it, learn how context works in React, and how to avoid unnecessary rerenders when using it.

Code from the lesson - https://github.com/senior-frontend/us...

Telegram - https://t.me/snr_fullstack

00:00 - Announcement of the last topic in the React Hooks series
00:33 - Prop Drilling
00:52 - Getting to know the example code without using context
02:39 - Why Prop Drilling is bad
04:09 - The differences between the approaches are illustrated in pictures
04:55 - Creating a context and provider, a little about defaultValue
07:55 - useContext instead of Prop Drilling
11:13 - Specifics of accessing the provider, more about defaultValue
14:06 - Why the Context API can't replace the state manager out of the box
15:39 - Context separation, MasterProvider
17:24 - Code review of the final example
18:00 - Performance differences in the final example with separated contexts Context
19:13 - Summary

GitHub Issues on context rerendering:
1. https://github.com/facebook/react/iss...
2. https://github.com/facebook/react/iss...


On this page of the site you can watch the video online Context in React. useContext and nested Context.Provider with a duration of hours minute second in good quality, which was uploaded by the user senior_zone 22 April 2023, share the link with friends and acquaintances, this video has already been watched 6,386 times on youtube and it was liked by 260 viewers. Enjoy your viewing!