3.2.2 • Published 6 years ago

@kraken97/restate v3.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Restate

CircleCI NPM Downloads

Into

This lib was created for reducing pain from redux boilerplaite.

  1. remove reducers and actions creators boilerplate
  2. remove boilerplate from binding actions, all actions are autbinded to their scope
  3. remove boilerplate from selecting hight level state, now to can use .select method on every reducer to select his state
  4. more sophisticated way for computed values which works without memoization (like mobx but more performat and without wrapping all the state into getters)
  5. more easier way for nested updates
  6. strictly typed and good test coverage

install

yarn add @kraken97/restate

how to use

doc soon see tree view example from redux

Play kxr5vy1x6v

import { createActions, createState, build } from "@kraken97/restate";

const actions = createActions({
  inc: build.plain
});

const countersState = createState([[0, 0, 0, 0]]);
// different types of counters
const state = createState({ counters: countersState });
state.on(actions.inc, (state, p) => {
  return state + 1;
});

//[OPTIONAL] auto bind all actions to redux
// store is redux store
state.use(store.dispatch);

countersState.select(store.getState()); // will return state from root

// dispatch actions
// all actions are autobinded to store after using .use action
// you can assign one action to multiple stores
// to access plain action call inc.raw();
inc(1);
inc(2);
inc(2);
inc(3);
inc(8);

test coverage

-------------------|----------|----------|----------|----------|-------------------|
File               |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-------------------|----------|----------|----------|----------|-------------------|
All files          |    93.02 |    86.11 |    87.37 |    93.08 |                   |
-------------------|----------|----------|----------|----------|-------------------|

todo

  1. improve types
  2. extend api with (comparators and computed see rfc.md)
  3. improve tests
  4. think about async actions
3.2.2

6 years ago

3.2.1

6 years ago

3.1.2

6 years ago

3.2.0

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.9

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago