0.0.6 • Published 4 years ago

@ekit/actions v0.0.6

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

name: Actions menu: 'Redux'

route: /ekit/actions

Actions

npm i -S @ekit/actions

示例

import { createAction, Action, handleActions, bindActionCreators, Dispatch } from '@ekit/actions';

const actions = {
  doSomething: () => createAction('DO', {})
};

const reducer = handleActions({
  DO: <S>(s: S, action: Action<{}>) => ({ ...s })
});

// bindActionCreators 通过 reselect 添加了 cache
function mapDispatchToProps(dispatch: Dispatch) {
  return {
    actions: bindActionCreators(actions, dispatch)
  };
}