Skip to content

Commit

Permalink
Merge branch 'master' of github.com:zackify/react-use-upload
Browse files Browse the repository at this point in the history
  • Loading branch information
zackify committed Mar 12, 2021
2 parents 39fd196 + f89b4f0 commit 634a07c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**Zero dependency, total control, file upload hook for React.**
**Zero dependency, total control, file upload hook for React with upload progress.**

This has been rewritten into a single file for simplicity, and the function signature has gotten much smaller.

Expand All @@ -24,7 +24,7 @@ Here's a basic example of uploading a single file to a url
const MyComponent = () => {
let [upload, { progress, done, loading }] = useUpload(({ files }) => ({
method: "PUT",
url: url,
url: "http://localhost:4000",
body: files[0],
}));

Expand Down Expand Up @@ -56,7 +56,7 @@ const MyComponent = () => {

return {
method: "PUT",
url: url,
url: "http://localhost:4000",
body: formData,
};
});
Expand All @@ -68,7 +68,7 @@ const MyComponent = () => {
type="file"
onChange={(e) => {
if (e.target.files) {
upload({ file: e.target.files[0] });
upload({ files: e.target.files });
}
}}
/>
Expand All @@ -89,7 +89,7 @@ const MyComponent = () => {

return {
method: "PUT",
url: url,
url: "http://localhost:4000",
body: formData,
headers: { Authorization: "test" },
};
Expand All @@ -102,7 +102,7 @@ const MyComponent = () => {
type="file"
onChange={(e) => {
if (e.target.files) {
upload({ file: e.target.files[0] });
upload({ files: e.target.files });
}
}}
/>
Expand All @@ -125,7 +125,7 @@ const MyComponent = () => {

return {
method: "PUT",
url: url,
url: "http://localhost:4000",
body: formData,
headers: { Authorization: "test" },
};
Expand All @@ -138,7 +138,7 @@ const MyComponent = () => {
type="file"
onChange={(e) => {
if (e.target.files) {
upload({ file: e.target.files[0] });
upload({ files: e.target.files });
}
}}
/>
Expand Down Expand Up @@ -172,7 +172,7 @@ const MyComponent = () => {
return {
method: "PUT",
url: url,
// send a single file in the body to the storage bucker
// send a single file in the body to the storage bucket
body: files[0],
};
});
Expand All @@ -190,7 +190,7 @@ const MyComponent = () => {
type="file"
onChange={(e) => {
if (e.target.files) {
upload({ file: e.target.files[0] });
upload({ files: e.target.files });
}
}}
/>
Expand Down

0 comments on commit 634a07c

Please sign in to comment.