Dead simple State Management with Stoxy

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…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Dead simple State Management with Stoxy." Matsuuu | Sciencx - Thursday April 29, 2021, https://www.scien.cx/2021/04/29/dead-simple-state-management-with-stoxy/
HARVARD
Matsuuu | Sciencx Thursday April 29, 2021 » Dead simple State Management with Stoxy., viewed ,<https://www.scien.cx/2021/04/29/dead-simple-state-management-with-stoxy/>
VANCOUVER
Matsuuu | Sciencx - » Dead simple State Management with Stoxy. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/29/dead-simple-state-management-with-stoxy/
CHICAGO
" » Dead simple State Management with Stoxy." Matsuuu | Sciencx - Accessed . https://www.scien.cx/2021/04/29/dead-simple-state-management-with-stoxy/
IEEE
" » Dead simple State Management with Stoxy." Matsuuu | Sciencx [Online]. Available: https://www.scien.cx/2021/04/29/dead-simple-state-management-with-stoxy/. [Accessed: ]
rf:citation
» Dead simple State Management with Stoxy | Matsuuu | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.