Component compositionPath 18/21
Components & propsCompositionState & eventsPersistence
Prerequisites are suggestions only. Every challenge stays open.
Theme Preference
Share a persistent preference through React context.
Requirements
- Create a strictly typed context.
- Throw a helpful error when the context is missing.
- Toggle between light and dark without duplicating state.
- Persist and restore the preference with
localStorage.
- Keep storage access inside state and event logic.