gitlike-redux
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

gitlike-redux

Use redux like git.

npm install --save gitlike-redux
# or
yarn add gitlike-redux

Instead of creating actions, reducers, and the rest of the boilerplate, just commit your store updates, like you would in git.

Your action type is your commit message (so it will show up in console). And your action body is an object that matches your store state, with edge properties wrapped using the val() helpers.

Basic example:

import { createStore } from 'redux';
import { reducer, commit, val } from 'gitlike-redux';

const store = createStore(reducer);

store.dispatch(
  commit('Initial state', val({
    initialized: false,
    config: {
      theme: 'light',
    }
  }))
);

store.dispatch(
  commit('Initialize and set dark mode', {
    initialized: val(true),
    config: {
      theme: val('dark'),
    }
  })
);

Library state: Used in production, but pretty rough.

Expect possible API changes.

Use at your own risk


What else is needed:

  • Array handling support
  • Batching commits (add() call?)
  • More tests
  • Documentation

License: MIT

Package Sidebar

Install

npm i gitlike-redux

Weekly Downloads

35

Version

0.2.0

License

MIT

Unpacked Size

60.5 kB

Total Files

24

Last publish

Collaborators

  • panta82