Skip to content

A decentralized, data structure-based, all-in-one state management solution for large-scale applications.

License

Notifications You must be signed in to change notification settings

amos-project/amos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b019850 · Dec 22, 2024
Oct 27, 2024
Oct 23, 2024
Dec 22, 2024
Oct 29, 2024
Nov 13, 2024
Dec 22, 2024
Nov 13, 2024
Nov 1, 2024
Jan 16, 2022
Oct 26, 2024
Aug 4, 2023
Aug 4, 2023
Oct 25, 2024
Oct 16, 2024
Oct 21, 2024
Oct 23, 2024
Oct 28, 2024
Oct 28, 2024
Dec 22, 2024
Oct 25, 2024
Oct 31, 2024

Repository files navigation

Amos

A decentralized, data structure-based, fully featured state management library.

Highlights

  • Decentralized (or, in a more trendy term: atomic).
  • Data structure-based: help you read/write state easily.
  • Strong TypeScript support.
  • All in one: everything in a single package amos with zero dependencies, including:
    • All commonly used data structures: Number, Boolean, Array, Object, List, Map.
    • Box relationships.
    • Batch.
    • Concurrent.
    • Cache.
    • React: Query, Suspense, Use.
    • SSR.
    • HTTP: Paging, Optimistic, Offline, Structure mapping.
    • Persistence: including Web, React Native, IndexedDB, SQLite.
    • Devtools.
  • Redux compatible, helping you seamlessly and smoothly migrate from Redux to amos.

Install

You can get everything via install npm package amos:

# via npm
npm i -S amos
# via yarn
yarn add amos
# via pnpm
pnpm i amos

Documentation

You can find the Amos documentation on the website.

Quick start

import { createStore, numberBox } from 'amos';
import { Provider, useDispatch, useSelector } from 'amos/react';
import { createRoot } from 'react-dom/client';

const countBox = numberBox('count');

function Count() {
    const dispatch = useDispatch();
    const count = useSelector(countBox);

    return (
        <div>
            <span>Click count: {count}.</span>
            <button onClick={() => dispatch(countBox.add(1))}>Click me</button>
        </div>
    );
}

const store = createStore();

createRoot(document.getElementById('root')!).render(
    <Provider store={store}>
        <Count />
    </Provider>,
);

About

A decentralized, data structure-based, all-in-one state management solution for large-scale applications.

Topics

Resources

License

Stars

Watchers

Forks

Languages