useMemory
Hook that gives you current memory usage
browser
low
test coverage
Last changed: 7 months ago
TIP
This hook uses performance.memory browser api to provide enhanced functionality. Make sure to check for compatibility with different browsers when using this api
Installation
Library
CLI
Manual
typescript
import { useMemory } from '@siberiacancode/reactuse';Usage
typescript
const { supported, value } = useMemory();Demo
Api
Returns
UseMemoryReturn
Type declaration
typescript
interface Performance {
memory: {
readonly jsHeapSizeLimit: number;
readonly totalJSHeapSize: number;
readonly usedJSHeapSize: number;
};
}
export interface UseMemoryReturn {
/** The memory supported status */
supported: boolean;
/** The current memory usage */
value: Performance['memory'];
}Source
Source • DemoContributors
D
H