Skip to content

Annevo/redux-eventually

Repository files navigation

redux-eventually

Build Status npm npm

Redux-eventually facilitates using CRDTs inside of the redux store. This library consists of factory methods for easier usage with these otherwise quite cumbersome data-structures.

Example Counter

import { createCounterAction, createCounterReducer, createCounterSelector } from "redux-eventually";

const COUNTER = "COUNTER";

export countAction = createCounterAction(COUNTER);
/*
{
  type: COUNTER,
  payload: {
    id: "adam",
    value: 1
  }
}
*/

export counterReducer = createCounterReducer();
/*
{
  type: "pn-counter",
  p: {
    adam: 1,
    gustav: 0
  },
  n: {
    adam: 1,
    gustav: 1
  }
}
*/

export counterSelector = createCounterSelector();

let store = createStore(todosReducer);
const state = todosReducer(countAction("adam", 1));
const todos = todosSelector(state);

About

Eventual consistency helpers for Redux apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published