This content originally appeared on DEV Community and was authored by Matsuuu
What
Stoxy is a new, modern, reactive state management system for web applications.
It's a small, dependencyless, extensible set of functions to create stateful features for you web app, and even persist them through sessions.
How
Stoxy requires no setup. After the install with
npm install @stoxy/core
You don't need to hassle with reducers, nor any initial state objects, you can immediately start writing stateful applications.
import { write } from '@stoxy/core';
const userData = {
userName: "Stoxy",
shoppingCart: [
{ id: 123, name: "Flaming hot cheetos" }
],
shoppingHistory: {
latestProducts: [
{ id: 555, name: "Doritos" },
{ id: 958, name: "Pringles" }
]
}
};
write("userData", userData);
Persisting objects through sessions can be done on a per-key basis with a single command
import { persistKey } from '@stoxy/core';
persistKey('userData');
Reading data through the promise based API is made simple too:
read('shoppingcart').then(shoppingCartItems => {
shoppingCartItems.map(item => console.log(item));
});
There are multiple user-tailored functions at your disposal for more specific actions too. Read more about them at the docs.
Where
Stoxy can be run anywhere, with any framework. Even with no framework at all.
Currently Stoxy ships with element mixins for Web Components and hooks for React/Preact.
Read more about Stoxy at the site: Stoxy.dev
Stoxy just reached 50 stars in Github. Join the stargazers at GitHub!
This content originally appeared on DEV Community and was authored by Matsuuu

Matsuuu | Sciencx (2021-04-29T16:18:55+00:00) Dead simple State Management with Stoxy. Retrieved from https://www.scien.cx/2021/04/29/dead-simple-state-management-with-stoxy/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.