Skip to main content

useRetryListener

Package​

@rpldy/retry-hooks

Installation​

npm install @rpldy/retry-hooks

Details​

Use this hook to have a component notified when a retry event is triggered. This happens for every item retry, whether the retry action was for an individual item, batch, or all failed items.

type RetryEventData = {
items: BatchItem[];
options: UploadOptions | void;
};

type RetryEventCallback = (data: RetryEventData) => void;

type useRetryListener = (cb: RetryEventCallback) => void;;
note

Event Hook - RETRY_EVENT

info

To enable retries for your Uploady instance, you need to use the provided (uploader enhancer): retryEnhancer.

Example​

import React  from "react";
import { useRetryListener } from "@rpldy/retry-hooks";

const MyComponent = ( ) => {

useRetryListener(({ items }) => {
console.log("##### RETRY EVENT - retrying items: ", items);
});

return <div/>;
};