Skip to main content

useRetry

Package​

@rpldy/retry-hooks

Installation​

npm install @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>;
};