Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 453 Bytes

README.md

File metadata and controls

16 lines (11 loc) · 453 Bytes

redux-selector-hooks

Common React hooks to be used with Redux

useCreateSelector

Usefull hook for passing component props inside selector

// At first, write function which takes props and returns selector
const createItemSelector = (itemIdx: string) => (state: RootState) =>
  state.items[itemIdx];

// You may use it inside component without manual memoization
const itemState = useCreateSelector([props.itemId], createItemSelector);