react-use-file-upload
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -76,3 +76,3 @@ "use strict"; | ||
} | ||
}, []); | ||
}, [files]); | ||
/** @function createFormData */ | ||
@@ -79,0 +79,0 @@ const createFormData = react_1.useCallback(() => { |
{ | ||
"name": "react-use-file-upload", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A React Hook to make dealing with file uploading easier.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -71,14 +71,17 @@ import { useState, useCallback } from 'react'; | ||
/** @function removeFile */ | ||
const removeFile = useCallback((file: number | string): void => { | ||
if (typeof file !== 'number' && typeof file !== 'string') { | ||
console.error('argument supplied to removeFile must be of type number or string.'); | ||
return; | ||
} | ||
const removeFile = useCallback( | ||
(file: number | string): void => { | ||
if (typeof file !== 'number' && typeof file !== 'string') { | ||
console.error('argument supplied to removeFile must be of type number or string.'); | ||
return; | ||
} | ||
if (typeof file === 'string') { | ||
setFilesState(files.filter((_file: File) => _file.name !== file)); | ||
} else { | ||
setFilesState(files.filter((_file: File, i) => i !== file)); | ||
} | ||
}, []); | ||
if (typeof file === 'string') { | ||
setFilesState(files.filter((_file: File) => _file.name !== file)); | ||
} else { | ||
setFilesState(files.filter((_file: File, i) => i !== file)); | ||
} | ||
}, | ||
[files], | ||
); | ||
@@ -85,0 +88,0 @@ /** @function createFormData */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12488
254