Statefully
📦 A tiny state container for your javascript apps
- 💡 Simple: Easy to learn & use APIs
- 📦 Small: Zero dependencies + 1kb minified size only
- 🔌 Pluggable: Use anywhere you want
- 🔒 Type-Safe: Great type support with TypeScript & Flow
⚠ NOTE: This project is under active development!
🔧 Installation
NodeJS
# Using npm npm install statefully # Using yarn yarn add statefully
HTML
📦 Usage
Create container
// Using ES Module;// Using CommonJSconst createContainer = ; // Create container with initial valueconst store = ;
Get container state
store; // { greeting: "John" }
Actions
// Create actionconst setGreeting = storeaction greeting: name ; // Call action; store; // { greeting: "Doe" }
Subscribe container
store;
📝 Guide
With TypeScript
// Create container;; // Create action;; // Call actionsetGreeting;
🌟 Features
- ✅ Actions
- ❌ Merge actions
- ✅ Subscription
- ✅ TypeScript Support
- ❌ Flow Support
- ❌ React binding