|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
512 bytes
|
| Line | |
|---|
| 1 | import type { ActionCreatorsMapObject, Dispatch } from 'redux'
|
|---|
| 2 |
|
|---|
| 3 | export 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 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.