@jweston/trigger
v0.21.7
Published
⚡Data-oriented state management for React
Maintainers
Readme
Welcome to Trigger!
Trigger is a lightweight, zero-dependency state management library purpose-built for React and TypeScript. It is designed to bridge the gap between high-performance data handling and an intuitive developer experience.
Core Philosophies
Trigger blends the structural clarity of traditional database systems with the reactive nature of modern UI development, all wrapped in a robust type system that provides full type hints for the data in your store.
- Database Patterns: It utilizes familiar concepts like
INSERT/UPDATE/DELETEand automated triggers to ensure data integrity and a simple mental model. - The Flux Pattern: Drawing inspiration from the architecture popularized by Redux and Zustand, Trigger employs a predictable, unidirectional data flow. This ensures state changes are transparent, traceable, and easy to debug.
- Reactivity: Trigger features computed values that automatically and efficiently stay in sync when their dependencies change.
- End-to-End Type Safety: The robust type system provides full type hints and autocomplete for all data types residing in the data store, catching errors at compile time and eliminating guesswork.
- State Modularity: Easily create separate, dedicated stores throughout your application. This modular approach enforces a clean separation of concerns, preventing global state bloat and keeping your architecture maintainable as your project scales.
- High-Performance Rendering: Engineered specifically for data-intensive applications, Trigger uses internal change tracking to enable highly granular DOM updates. Your React components only re-render when the specific data they depend on changes, drastically reducing unnecessary compute strain on React's diffing algorithm.
npm i @jweston/trigger