import { useCallback } from 'react';
import { useEventCallbackRef } from '../../utils/hooks/useEventCallbackRef';
export function useItemHandler(props) {
    var item = props.item, onDelete = props.onDelete, onRetry = props.onRetry;
    var onDeleteRef = useEventCallbackRef(onDelete);
    var onRetryRef = useEventCallbackRef(onRetry);
    var deleteHandler = useCallback(function (e) {
        var _a;
        e.stopPropagation();
        (_a = onDeleteRef.current) === null || _a === void 0 ? void 0 : _a.call(onDeleteRef, item);
    }, [item, onDeleteRef]);
    var retryHandler = useCallback(function (e) {
        var _a;
        e.stopPropagation();
        (_a = onRetryRef.current) === null || _a === void 0 ? void 0 : _a.call(onRetryRef, item);
    }, [item, onRetryRef]);
    return {
        deleteHandler: deleteHandler,
        retryHandler: retryHandler,
    };
}
