1.0.7 • Published 8 years ago

redrx v1.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

redrx

An implementation of Redux using observables.

Note: This is a pre-alpha release and probably should not be used in production.

Useage

Think about this as basically redux, except everything is an observable.

Simple counter example:

const reducer = (state: number = 0, action) => {
  if (!action) {
    return state;
  }

  switch (action.type) {
    case 'INCREMENT':
      return state + 1;
    case 'DECREMENT':
      return state - 1;
    default:
      return state;
  }
}

const store = new Store<number>(reducer);

store.state.subscribe((state) => {
  // Do stuff with your new state in here
});

store.dispatch.next({ type: 'INCREMENT' }); // State will be 1
store.dispatch.next({ type: 'INCREMENT' }); // State will be 2
store.dispatch.next({ type: 'DECREMENT' }); // State will be 1
1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago