UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

19 lines (18 loc) 507 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useCombinedRefs = void 0; var _react = require("react"); const useCombinedRefs = (...refs) => (0, _react.useCallback)(element => { refs.forEach(ref => { if (!ref) return; if (typeof ref === 'function') { ref(element); } else if (typeof ref === 'object' && ref !== null) { ref.current = element; } }); }, [refs]); exports.useCombinedRefs = useCombinedRefs; //# sourceMappingURL=ref.js.map