Context in React. useContext and nested Context.Provider

Pubblicato il: 22 aprile 2023
sul canale di: 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...


In questa pagina del sito puoi guardare il video online Context in React. useContext and nested Context.Provider della durata di ore minuti seconda in buona qualità , che l'utente ha caricato senior_zone 22 aprile 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 6,386 volte e gli è piaciuto 260 spettatori. Buona visione!