A lightweight, push-based, framework-agnostic state management library inspired by Svelte stores with computed and batch extensions.
Tansu is a lightweight, push-based state management library that is framework-agnostic, inspired by Svelte stores. It provides reactive stores with APIs for writable, derived, and computed states, along with batch updates to handle multiple changes consistently. It solves the problem of managing application state with minimal boilerplate and glitch-free reactivity across different frameworks.
Frontend developers working with Svelte, Angular, or other JavaScript frameworks who need a simple, flexible state management solution without framework lock-in.
Developers choose Tansu for its tiny size, zero dependencies, and expressive API that reduces boilerplate while offering advanced features like computed stores and batch updates, ensuring consistent state transitions and compatibility with multiple frameworks.
tansu is a lightweight, push-based framework-agnostic state management library. It borrows the ideas and APIs originally designed and implemented by Svelte stores and extends them with computed and batch.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
At only 1300 lines of code with zero external dependencies, Tansu keeps bundles small and simplifies maintenance, as highlighted in the README.
It works seamlessly with Svelte, Angular, and other frameworks without tight coupling, demonstrated by integration examples in the documentation.
The batch function defers subscriber notifications to prevent intermediate inconsistent states, fixing issues like the asymmetric diamond dependency problem mentioned in the README.
Offers both derived and computed stores with implicit or explicit dependencies, enabling efficient reactive transformations and natural switch maps, as shown in usage examples.
Computed stores cannot handle asynchronous state, forcing use of derived stores for async operations, which adds complexity for certain use cases.
All updates and notifications are synchronous, which can cause performance bottlenecks in apps with many subscribers if not carefully managed via batch.
As a minimal library, it lacks advanced features like middleware, persistence, or debugging tools, requiring custom implementations for complex needs.