Context API in React - useContext Hook tutorial in React -

Pubblicato il: 18 January 2024
sul canale di: Learn Coding with EmAar
633
20

GitHub Repo (feel free to fork & smash the ⭐ ): https://github.com/Em-Aar/useContext-...
Link to useContext Hook Documentation: https://react.dev/reference/react/use...

00:00 intro
00:30 App Component Tree
01:50 Prop Drilling
05:10 When we use Context API/useContext Hook
13:10 Steps to Create Context API
17:55 Prop Drilling example in Code
27:45 Passing Data Deeply in a Component Tree
27:45 Step-1: Create Context
30:30 Step-2: Create Provider
33:20 Step-4 Use useContext
39:35 How useContext and Provider relationship
44:20 Extracting Providers to a Component
48:25 Updating data passed via context
01:09:20 Components rendering with context change

In this video, you will learn how to use the React context API and the useContext hook in Next.js 14, a framework for building fast and user-friendly web applications using React. You will also learn what is prop drilling, why it is a problem, and how to avoid it using the useContext hook.

The React context API allows you to share data across your component tree without passing props down manually at every level. The useContext hook lets you access the context value from any component that is a child of a context provider. This makes your code more readable, maintainable, and performant.

You will see different scenarios of using the useContext hook, such as:

• Creating and providing a context value to your components

• Consuming the context value using the useContext hook

• Updating the context value using a function or a state variable

• Using multiple contexts in your app


By the end of this video, you will have a solid understanding of how to use the React context API and the useContext hook in Next.js 14, and how to apply them to your own projects.


In questa pagina del sito puoi guardare il video online Context API in React - useContext Hook tutorial in React - della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Learn Coding with EmAar 18 January 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 633 volte e gli è piaciuto 20 spettatori. Buona visione!