react-resize-detector
- Version 11.0.1
- Published
- 59.1 kB
- 1 dependency
- MIT license
Install
npm i react-resize-detector
yarn add react-resize-detector
pnpm add react-resize-detector
Overview
React resize detector
Index
Functions
function useResizeDetector
useResizeDetector: <T extends HTMLElement = any>({ skipOnMount, refreshMode, refreshRate, refreshOptions, handleWidth, handleHeight, targetRef, observerOptions, onResize,}?: useResizeDetectorProps<T>) => UseResizeDetectorReturn<T>;
Interfaces
interface useResizeDetectorProps
interface useResizeDetectorProps<T extends HTMLElement> extends Props {}
property targetRef
targetRef?: MutableRefObject<T | null>;
interface UseResizeDetectorReturn
interface UseResizeDetectorReturn<T> extends Dimensions {}
property ref
ref: OnRefChangeType<T>;
Type Aliases
type Dimensions
type Dimensions = { height?: number; width?: number;};
type OnResizeCallback
type OnResizeCallback = (payload: ResizePayload) => void;
type ResfreshModeType
type ResfreshModeType = 'throttle' | 'debounce';
type ResfreshOptionsType
type ResfreshOptionsType = { leading?: boolean; trailing?: boolean;};
type ResizePayload
type ResizePayload = | { width: number; height: number; entry: ResizeObserverEntry; } | { width: null; height: null; entry: null; };
If element is mounted, returns its dimensions and
ResizeObserverEntry
If element is unmounted, returns null
Package Files (3)
Dependencies (1)
Dev Dependencies (15)
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-resize-detector
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-resize-detector)
- HTML<a href="https://www.jsdocs.io/package/react-resize-detector"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2642 ms. - Missing or incorrect documentation? Open an issue for this package.