(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "react"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var react_1 = require("react");
    var useForkRef = function (refs) {
        return (0, react_1.useMemo)(function () {
            if (refs.length < 1) {
                return null;
            }
            return function (refValue) {
                refs.forEach(function (ref) {
                    if (typeof ref === "function") {
                        ref(refValue);
                    }
                    else if (ref) {
                        ref.current = refValue;
                    }
                });
            };
        }, [refs]);
    };
    exports.default = useForkRef;
});
