"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useActions = void 0;
var react_1 = require("react");
var ramda_1 = require("ramda");
var useActions = function (_a) {
    var actions = _a.actions, dispatch = _a.dispatch;
    return (0, react_1.useMemo)(function () {
        return Object.entries(actions).reduce(function (acc, _a) {
            var _b;
            var actionName = _a[0], actionCreator = _a[1];
            return __assign(__assign({}, acc), (_b = {}, _b[actionName] = (0, ramda_1.pipe)(actionCreator, dispatch), _b));
        }, {});
    }, [dispatch, actions]);
};
exports.useActions = useActions;
