import { useCallback } from 'react';
import { useMounted } from './useMounted';
export function useAsyncSafeDispatch(dispatch) {
    var mounted = useMounted();
    return useCallback(function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        mounted.current && dispatch.apply(void 0, args);
    }, [dispatch, mounted]);
}
