Ref API
UpupUploader exposes the same behavior surface as useUpupUpload.
tsx
const ref = useRef<UploaderRef>(null)
<UpupUploader ref={ref} uploadEndpoint="/api/upload-token" />ts
type UploaderRef = {
useUpload(): {
error?: string
files: UploadFile[]
loading: boolean
progress: number
upload(): Promise<UploadFile[] | undefined>
retryUpload(fileId?: string): Promise<UploadFile[] | undefined>
resetState(): void
uploadFiles(
files: File[] | UploadFile[],
): Promise<UploadFile[] | undefined>
setFiles(newFiles: File[]): void
replaceFiles(files: File[] | UploadFile[]): void
}
}UploaderRef is exported from @useupup/react; UploadFile is exported from
@useupup/core/contracts.
retryUpload(fileId?) re-attempts the file with that ID. Omit the ID to re-attempt every file that failed or has not uploaded yet. A call made while an upload is running joins that run, and the call rejects after the uploader is destroyed.