In this video, Emmanuel Henri demonstrates how to implement multiple context providers in the base project.
- [Narrator] Okay, so now let's explore … how you would add multiple contexts … inside of one application. … And, you're going to find it very simple … because it's very much the same way … that we've done so far. … It's basically creating more contexts and then … passing the right value to those contexts. … So, let's create another context … that we're going to call Theme. … So, let's copy that here. … And then, let's call this guy Theme. … And now, we create a new context so we have two … contexts inside of the same application. … And then let's export another consumer. … So let's go and copy line seven … and paste it. … And then, let's call this guy Theme Consumer. … And leverage theme here. … So now we've created a second context. … So what we're going to go do now is create some data … we can pass to that second context. … So what I'm going to do here, is create a simple … styles object inside of my state. … Let's go ahead and create that. … And, basically we're going to do display, …
- Creating a context object
- Implementing the code for updating context
- Updating context from a nested component
- What to avoid when working with context
- How the node tree in React applies to context
- Consuming multiple contexts