useRetryListener
Packageβ
Installationβ
- npm
- Yarn
- pnpm
npm install @rpldy/retry-hooks
yarn add @rpldy/retry-hooks
pnpm add @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;;
- See: UploadOptions
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/>;
};