Overview
The Todo App demonstrates advanced GlyphUI features:- Global state management with
createStore() - Component composition with
connect() - Multiple stores (todo + theme)
- Filtering and batch operations
- Theme switching with dark mode
Live Demo
View the complete source code on GitHub
What You’ll Learn
Store Creation
Creating global stores with createStore()
Connect Pattern
Connecting components to stores
State Selectors
Selecting specific state slices
Theme Switching
Implementing dark/light mode
Complete Code
Store Definitions
vercel-todo.js
Connected Components
Key Concepts
1. Creating Stores
Stores are created withcreateStore() and a setter function:
The
set function can take an object or a function that receives the current state.2. Connecting Components
Useconnect() to subscribe components to store updates:
props.store to the component.
3. State Selectors
You can select specific state slices when connecting:4. Computed Properties
Derived state can be calculated in the store:Features Demonstrated
State Management
State Management
- Multiple independent stores (theme + todo)
- Immutable state updates
- Computed properties
User Interactions
User Interactions
- Add todos with Enter key
- Toggle completion status
- Delete todos
- Filter by status (all/active/completed)
- Clear all completed todos
Advanced Patterns
Advanced Patterns
- Ref usage for input focus
- Conditional rendering
- Theme persistence via data attributes
- Statistics calculation
Running the Example
Next Steps
State Management
Learn more about stores and state
Lazy Loading
Optimize performance with lazy loading
Connect API
Detailed connect() documentation
Store API
Detailed createStore() documentation