![Coverage Status](https://camo.githubusercontent.com/7a56227a0c30f24951d3617dec1f6e5eae9a6cd1740c39541f54faf18f03ae55/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f77686a313939352f747970652d72656475782d686f6f6b2f62616467652e7376673f6272616e63683d6d6173746572)
npm install type-redux type-redux-hook
import { createUseMappedState } from 'type-redux-hook';
import { createStore } from 'type-redux';
...
const store = createStore(todo, state);
export const useMappedState = createUseMappedState(store);
export const commit = store.commit;
export const dispatch = store.dispatch;
import { commit, dispatch, useMappedState } from './xxx';
function Component() {
const { list, maxId } = useMappedState((state) => ({ list: state.list, maxId: state.maxId }));
return <div onClick={() => dispatch('xxx', 'xxx')} ></div>;
}
https://github.com/whj1995/type-redux-hook/tree/master/demo