
package.dist.cjs.hooks.use-callback-ref.cjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react Show documentation
Show all versions of react Show documentation
Responsive and accessible React UI components built with React and Emotion
The newest version!
"use strict";
"use client";
'use strict';
var React = require('react');
function useCallbackRef(callback, deps = []) {
const callbackRef = React.useRef(() => {
throw new Error("Cannot call an event handler while rendering.");
});
React.useInsertionEffect(() => {
callbackRef.current = callback;
});
return React.useCallback((...args) => callbackRef.current?.(...args), deps);
}
exports.useCallbackRef = useCallbackRef;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy