State and eventsPath 4/21
State & eventsConditional renderingAccessibility
Prerequisites are suggestions only. Every challenge stays open.
Accessible Toggle Switch
Create a reusable on/off control using a real button and React state.
Requirements
- Initialize the preference to off.
- Toggle it on every click without mutating state.
- Use
role="switch" and keep aria-checked synchronized.
- Apply the
enabled class only when active.
- Keep a meaningful accessible label in both states.