2.0.0 • Published 4 years ago

type-redux-hook v2.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

type-redux的react-hook

npm version Build Status Coverage Status

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>;
}

Example

https://github.com/whj1995/type-redux-hook/tree/master/demo

2.0.0

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago