Skip to content

useMemory ​

Hook that gives you current memory usage

browser
low
test coverage
Last changed: 27 days ago

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 • Demo

Contributors ​

D
debabin
debabin
H
hywax
hywax

Released under the MIT License.