UNPKG

@react-nano/tsrux

Version:

tsrux stands for typesafe redux. It reduces boilerplate redux code.

12 lines (11 loc) 343 B
export function actionCreator(type, getPayload, getMeta) { const creator = (...args) => { const action = { type }; if (getPayload) action.payload = getPayload(...args); if (getMeta) action.meta = getMeta(...args); return action; }; return Object.assign(creator, { type }); }