Context in React. useContext and nested Context.Provider

Veröffentlicht am: 22 April 2023
auf dem Kanal: 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...


Auf dieser Seite können Sie das Online-Video Context in React. useContext and nested Context.Provider mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer senior_zone 22 April 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 6,386 Mal angesehen und es wurde von 260 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!