3.0.0 • Published 5 years ago

tkit-actions v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

name: actions

menu: 'redux'

npm i tkit-actions

Usage

import { createAction, Action, handleActions, bindActionCreators, Dispatch } from 'tkit-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)
  };
}