Skip to content

Commit

Permalink
Add makeActionCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimkorr committed May 3, 2021
1 parent 5faec4e commit eda7f42
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/utils/makeActionCreator.js
Original file line number Diff line number Diff line change
@@ -0,0 1,12 @@
export const makeActionCreator = (type, keys) => {
return (...values) => {
const payload = {}
keys.forEach((_, index) => {
payload[keys[index]] = values[index]
})
return {
type,
payload,
}
}
}

0 comments on commit eda7f42

Please sign in to comment.