Current section: Compound Components 30 exercises
Problem

Compound Components

Loading exercise

Transcript

00:00 Right now we're actually not doing a whole lot and you're going to have to be you're going to have to implement Everything that we're going to be doing so I'm going to show you what the finished version looks like We've got this switch and we already have a switch component. It accepts an on prop and on click for

00:16 Updating the value but yeah, you just you can focus on it and then I'm hitting the spacebar But then we also have some components for when the button is on I want you to show this when the button is off I want you to show this and so we have our toggle on we have our toggle off and our toggle button And we need to provide some

00:36 State for each one of these things so that we can provide the API that our users are looking for which you can find in The app right here. So we have our toggle We have our toggle on our toggle off and our toggle button That's the API that our users want to have so the toggle it needs to be our context provider

00:55 And it's going to manage all of the state and then it's going to share implicitly the state As well as mechanisms for updating the state to these other components and so through that we get this really nice declarative API So that is the API you need to implement right now. It's not doing a whole lot so get to work