Reactive state using Proxy and EventTarget - no frameworks!
A simple counter demonstrating reactive state updates:
Counter Value
Total Clicks
State Changes
Manage user profile with persistent state:
💾 This store persists to localStorage. Try refreshing the page!
All state changes are logged here:
// Create a reactive store
const store = createStore({ count: 0 });
// Subscribe to all changes
store.subscribe((e) => {
console.log('State changed:', e.detail);
});
// Watch specific property
store.watch('count', (e) => {
console.log('Count:', e.detail.value);
});
// Update state (triggers events)
store.state.count = 5;