Context in React. useContext and nested Context.Provider

Опубликовано: 22 Апрель 2023
на канале: 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...


На этой странице сайта вы можете посмотреть видео онлайн Context in React. useContext and nested Context.Provider длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь senior_zone 22 Апрель 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 6,386 раз и оно понравилось 260 зрителям. Приятного просмотра!