React Hook to detect the browser storage limit
$ npm i use-browser-storage-limit
import useBrowserStorageLimit from "use-browser-storage-limit";
function App() {
const { loading, quota, usage, percentage, error } = useBrowserStorageLimit()
return (
<div className="App">
{loading ? <p>Loading...</p> : error ? <div><p>Error: {error}</p></div> : <div>
<p>Total Quota: {quota}</p>
<p>Total Usage: {usage}</p>
<p>Percentage Used: {percentage}%</p>
</div>}
</div>
);
}
Name | Type | Default | Description |
---|---|---|---|
loading | Boolean | false | Loader |
quota | Number | 0 | Total space of the Storage |
usage | Number | 0 | Used space of the Storage |
percentage | Number | 0 | Percentage of Storage used |
error | String | () => {} |
Async Storage clear item method |
getQuota | function | () => { quota, usage } |
Async function to get the estimate of the Storage |
- @pritishvaidya The main author.
Feel free to contact me or create an issue