react-upload-progress
React component to observe file upload / form post progress using render props, with maximum flexibility!
Concept
- Handle most of the tedious xhr stuff for you
- You will have full control for the UI part, thanks to render props pattern
- You can still customize the xhr detail, wuch as headers, withCredentials, and the data to send
Install
npm install --save react-upload-progress
Usage
; <UploadProgress url=YOUR_UPLOAD_URL formData=formData> <div> status === UploadStatusIDLE && <h2>Not started</h2> status === UploadStatusSENDING && <div> <h2>Uploading</h2> <h3>` / `</h3> </div> status === UploadStatusDONE && <div> <h2>Done</h2> <h3>JSON</h3> <button onClick= this>OK</button> </div> status === UploadStatusERROR && <div> <h2>Error</h2> <h3>JSON</h3> <button onClick= this>OK</button> </div> </div> </UploadProgress>
Examples
Full examples can be found in examples
directory