Skip to content

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';constcountBox=numberBox('count');functionCount(){constdispatch=useDispatch();constcount=useSelector(countBox);return(<div><span>Clickcount: {count}.</span><buttononClick={()=>dispatch(countBox.add(1))}>Clickme</button></div>);}conststore=createStore();createRoot(document.getElementById('root')!).render(<Providerstore={store}><Count/></Provider>,);

About

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

Topics

Resources

Stars

14 stars

Watchers

6 watching

Forks

Releases

Contributors

Languages