What problem does it solve?
Atomico's context system solves the problem of sharing state or dependencies across nested web components without prop-drilling, especially across shadow DOM boundaries, by providing a purpose-built, event-based context API.
Core Features & Use Cases
- createContext: Define a context with a default value and register it as a custom element to provide values to descendants.
- useContext: Consume the current value from the nearest provider, enabling reactive components to respond to changes.
- useProvider: Provide a value for a context to all descendants, supporting dynamic updates and overrides through nesting.
- Nested contexts and value overrides across different tree levels enable scoped configuration for complex component trees.
- Cross-shadow DOM communication uses events to traverse boundaries safely.
Quick Start
Define a context with createContext, wrap your components with a provider, and consume the value with useContext.