@isogon/inject

A middleware that injects dependencies for redux action creators

Stats

StarsIssuesVersionUpdatedCreatedSize
@isogon/inject
0.0.115 years ago5 years agoMinified + gzip package size for @isogon/inject in KB

Readme

@isogon/inject

@isogon/inject is a simple way to allow you to dispatch a function that gets injected later.

import {
  createStore,
  applyMiddleware,
  compose,
} from 'redux';
import inject from '@isogon/inject';

import reducer from './reducers'; // Your reducers
import someHelper from './someHelper'; // Something you need in your actions

const initialState = {};
const middleware = applyMiddleware(inject({
  someHelper,
});
const store = compose(middleware)(createStore)(reducer, initialState);

store.dispatch(({ someHelper }) => someHelper('DO_THE_THING'));

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.