Compound Components Validation
Loading "Compound Components Validation"
Run locally for transcripts
import { ToggleButton } from './toggle'
export const App = () => <ToggleButton />
Why doesn't that work (it's not supposed to, but can you explain why)? Can you
figure out a way to give the developer a better error message that explains what
they're doing wrong and how to fix it?
π¨ The tests will tell you in the message for the error you must throw when the
context is undefined.
π¦Ί Additionally, this is where we can make TypeScript happier (TypeScript knew
about the problem we'd run into in this step of the exercise!). Remember,
TypeScript isn't making your life terrible. It's just showing you how terrible
your life already is π In this exercise, we're going to make our lives better.