Let's go through some exercises on the useContext hook in React together.
We start with a warmup to get practice setting up all the steps needed for a Context Provider to share values to children through through the useContext hook.
Then we look at our first exercise where we take what we learned in the warmup but add stateful values to it such that the child can re-render state through useState.
For the second exercise, we look at a situation where we can have multiple contexts stacked on top of one another and how to deal with this from both the Provider's perspective and the Consumer.
To wrap up the video, we mix useContext with useReducer to amplify our state management abilities.
Chapters:
00:00 Introduction
00:49 Warmup Exercise - Context Intro
13:09 Exercise 1 - Context useState
21:50 Exercise 2 - Two Contexts
35:30 Exercise 3 - Context useReducer
48:38 Next Steps
📦 Github Repository with the notes and exercise code+solutions: https://github.com/Nooder/react-in-depth
💬 Come join us on Discord to chat with a like-minded community about tech and learning: / discord
🏅Support the channel and content through Super Thanks, Channel Memberships, or on Patreon: / techwithnader