![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
react-use-downloader
Advanced tools
Creates a download handler function and gives progress information
Creates a download handler function with its progress information and cancel ability.
Statements | Branches | Functions | Lines |
---|---|---|---|
Plain |
---|
![]() |
Preview! |
npm install --save react-use-downloader
import React from 'react';
import useDownloader from 'react-use-downloader';
export default function App() {
const {
size,
elapsed,
percentage,
download,
cancel,
error,
isInProgress,
} = useDownloader();
const fileUrl =
'https://upload.wikimedia.org/wikipedia/commons/4/4d/%D0%93%D0%BE%D0%B2%D0%B5%D1%80%D0%BB%D0%B0_%D1%96_%D0%9F%D0%B5%D1%82%D1%80%D0%BE%D1%81_%D0%B2_%D0%BF%D1%80%D0%BE%D0%BC%D1%96%D0%BD%D1%8F%D1%85_%D0%B2%D1%80%D0%B0%D0%BD%D1%96%D1%88%D0%BD%D1%8C%D0%BE%D0%B3%D0%BE_%D1%81%D0%BE%D0%BD%D1%86%D1%8F.jpg';
const filename = 'beautiful-carpathia.jpg';
return (
<div className="App">
<p>Download is in {isInProgress ? 'in progress' : 'stopped'}</p>
<button onClick={() => download(fileUrl, filename)}>
Click to download the file
</button>
<button onClick={() => cancel()}>Cancel the download</button>
<p>Download size in bytes {size}</p>
<label for="file">Downloading progress:</label>
<progress id="file" value={percentage} max="100" />
<p>Elapsed time in seconds {elapsed}</p>
{error && <p>possible error {JSON.stringify(error)}</p>}
</div>
);
}
useDownloader()
returns:
key | description | arguments |
---|---|---|
size | size in bytes | n/a |
elapsed | elapsed time in seconds | n/a |
percentage | percentage in string | n/a |
download | download function handler | (downloadUrl: string, filename: string) |
cancel | cancel function handler | n/a |
error | error object from the request | n/a |
isInProgress | boolean denoting download status | n/a |
const {
size,
elapsed,
percentage,
download,
cancel,
error,
isInProgress,
} = useDownloader();
react-use-downloader is MIT licensed.
This hook is created using create-react-hook.
FAQs
Creates a download handler function and gives progress information
The npm package react-use-downloader receives a total of 0 weekly downloads. As such, react-use-downloader popularity was classified as not popular.
We found that react-use-downloader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.