@hinata_hyuga/use-dom-resize
v1.0.5
Published
React hooks for listening dom element resize event
Downloads
2
Maintainers
Readme
use dom resize
React hooks for listening dom element resize event
Install
yarn add @hinata_hyuga/use-dom-resize
Usage
import useDomResize from '@hinata_hyuga/use-dom-resize'
function MyComponent() {
const ref = useRef(null)
const { width, height } = useDomResize(ref)
useEffect(() => {
console.log('div size change')
}, [width, height])
return (
<div
style={{
width: '100%',
height: '100%'
}}
ref={ref}
>
test
</div>
)
}