ÿØÿà JFIF ` ` ÿþ
|
Server : Apache System : Linux cloud.heroica.com.br 4.18.0-553.36.1.el8_10.x86_64 #1 SMP Wed Jan 22 03:07:54 EST 2025 x86_64 User : farolpborg ( 1053) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /var/www/node_services/datajud/frontend/node_modules/@restart/hooks/cjs/ |
Upload File : |
"use strict";
exports.__esModule = true;
exports.default = void 0;
exports.mergeRefs = mergeRefs;
var _react = require("react");
const toFnRef = ref => !ref || typeof ref === 'function' ? ref : value => {
ref.current = value;
};
function mergeRefs(refA, refB) {
const a = toFnRef(refA);
const b = toFnRef(refB);
return value => {
if (a) a(value);
if (b) b(value);
};
}
/**
* Create and returns a single callback ref composed from two other Refs.
*
* ```tsx
* const Button = React.forwardRef((props, ref) => {
* const [element, attachRef] = useCallbackRef<HTMLButtonElement>();
* const mergedRef = useMergedRefs(ref, attachRef);
*
* return <button ref={mergedRef} {...props}/>
* })
* ```
*
* @param refA A Callback or mutable Ref
* @param refB A Callback or mutable Ref
* @category refs
*/
function useMergedRefs(refA, refB) {
return (0, _react.useMemo)(() => mergeRefs(refA, refB), [refA, refB]);
}
var _default = useMergedRefs;
exports.default = _default;