/**
 * @license MIT
 * author: Cube Dev Team
 * @cube-dev/ui-kit v0.0.0-canary-9f40d0e
 * Released under the MIT license.
 */

import { useCallback } from 'react';
import { useSyncRef } from './use-sync-ref.js';
/**
 * useEvent shim from the latest React RFC.
 *
 * @see https://github.com/reactjs/rfcs/pull/220
 * @see https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md#internal-implementation
 */
export function useEvent(callback) {
    const callbackRef = useSyncRef(callback);
    return useCallback((...args) => callbackRef.current(...args), []);
}

        