Practice ยท 1 of 3
Disclosure Widget Logic
Write createDisclosure() returning { toggle, isOpen, state }: internal open boolean starts false; toggle() flips it and RETURNS the new state string ("expanded"/"collapsed"); state() returns { open, ariaExpanded: open ? "true" : "false", hidden: !open } โ exactly the attributes a real widget would set.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Component Systems โ Practice