useRetry
Packageβ
Installationβ
- npm
- Yarn
- pnpm
npm install @rpldy/retry-hooks
yarn add @rpldy/retry-hooks
pnpm add @rpldy/retry-hooks
Detailsβ
type RetryMethod = (id?: string) => boolean;
type useRetry = () => RetryMethod;
Returns a retry function.
When called without a parameter, will attempt retry all failed uploads. When called with a (id) parameter, will attempt retry for the failed batch-item identified by the id.
info
To enable retries for your Uploady instance, you need to use the provided (uploader enhancer): retryEnhancer.
Exampleβ
import React from "react";
import { useRetry } from "@rpldy/retry-hooks";
const MyComponent = ( ) => {
const retry = useRetry();
const onClick = () => {
retry("i-123");
};
return <button onClick={onClick}>retry item</button>;
};