MCPcopy
hub / github.com/reduxjs/react-redux / bindActionCreators

Function bindActionCreators

src/utils/bindActionCreators.ts:3–16  ·  view source on GitHub ↗
(
  actionCreators: ActionCreatorsMapObject,
  dispatch: Dispatch,
)

Source from the content-addressed store, hash-verified

1import type { ActionCreatorsMapObject, Dispatch } from 'redux'
2
3export default function bindActionCreators(
4 actionCreators: ActionCreatorsMapObject,
5 dispatch: Dispatch,
6): ActionCreatorsMapObject {
7 const boundActionCreators: ActionCreatorsMapObject = {}
8
9 for (const key in actionCreators) {
10 const actionCreator = actionCreators[key]
11 if (typeof actionCreator === 'function') {
12 boundActionCreators[key] = (...args) => dispatch(actionCreator(...args))
13 }
14 }
15 return boundActionCreators
16}

Callers 6

mapDispatchToProps2Function · 0.85
mapDispatchToProps3Function · 0.85
mapDispatchToProps4Function · 0.85
mapDispatchToProps5Function · 0.85
mapDispatchToProps6Function · 0.85

Calls 1

actionCreatorFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…