@alcadica/state-manager-logger
TypeScript icon, indicating that this package has built-in type declarations

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

/@alcadica/state-manager-logger/

    Package Sidebar

    Install

    npm i @alcadica/state-manager-logger

    Weekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    8.03 kB

    Total Files

    7

    Last publish

    Collaborators

    • npm-alcadica
    • octod