@breadhead/react-file-uploader
v2.0.4
Published
simple react file uploader
Downloads
18
Readme
react-file-uploader
Instalation
yarn add --dev @breadhead/react-file-uploader
Usage
import * as React from "react";
import { Uploader } from "@breadhead/react-file-uploader";
<Uploader
id="my-uploader"
uploadFile={(file: File, onProgress?: onProgress) => Promise<UploadedFile>}
onError={(err: Error) => void}
onUploaded={(url: string) => void}
>
{({ path, uploading, progress }: RenderProps) => (
<>
<ProgressBar progress={progress} />
{!!uploading && <p>file is uploaded from {path}</p>}
</>
)}
</Uploader>
interface RenderProps {
path: string
uploading: boolean
progress: number
}