All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.cjs.hooks.use-callback-ref.cjs Maven / Gradle / Ivy

Go to download

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