State Management

Reactive state management patterns with createState, selectors, computed values, and performance optimizations. Demonstrating @core/state capabilities.

Counter with createState

Demonstrates atomic state updates with fine-grained reactivity

0

Current Value

Render Metrics

Track how state updates affect component rendering

0

State Updates

1

Render Count

Pattern: createState

// Create atomic state

const counterState = createState({ count: 0 });

// Subscribe with selector

const count = useSelector(counterState, s => s.count);

// Update state

counterState.setState(s => ({ count: s.count + 1 }));