Skip to content

useResizeObserver ​

Dynamically get the size change of Dom elements.

Code demonstration ​

API ​

typescript
useResizeObserver(target, callback, {
  box: UseResizeObserverOptions,
})

Params ​

参数说明类型默认值
targetDOM 节点或者 Ref 对象() => Element | Element | JSX.Element-
options额外的配置项UseResizeObserverOptions-

Options ​

参数说明类型默认值
box盒模型模式ResizeObserverBoxOptionscontent-box

Source ​

Source · Document · Demo

Released under the MIT License.