Noosphere Possibilities Maximized
Miss any of our Open RFC calls?Watch the recordings here! »

@alcadica/state-manager-logger

1.0.3 • Public • Published

state-manager-logger

Coverage Maintainability

Install

npm i --save @alcadica/{state-manager,state-manager-logger}

Usage

This middleware will log every action dispatch inside your console

Example:

import createStore from '@alcadica/state-manager';
import Logger from '@alcadica/state-manager-logger';
 
const store = createStore({ foo: 100 });
const enabled = true;
 
store.use(Logger(enabled));
 
const increment = store.createAction<number>('increment');
 
store.reducer.connect((state, action, update) => {
  if (action.type === increment.type) {
    update({ foo: state.foo + action.payload });
  }
});
 
store.dispatch(increment(1)) // this will log you action and state

Licence

MIT

Install

npm i @alcadica/state-manager-logger

DownloadsWeekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

8.03 kB

Total Files

7

Last publish

Collaborators

  • avatar
  • avatar