d

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567
ouroffice@aware.com

 

KMF

Element Resize Observer Hook For React

A React hook that tracks changes to the dimensions of an element using the ResizeObserver API.

How to use it:

1. Install and import the React hook.

# NPM
$ npm i resize-observer-hook --save
import useResizeObserver from 'resize-observer-hook'

2. Basic usage.

const App = () => {
  const [ref, width, height] = useResizeObserver()
  return (
    <div ref={ref}>
      {width} X {height}
    </div>
  )
}

Preview:

Download Details:

Author: Gautam-Arora24

Live Demo: View The Demo

Download Link: Download The Source Code

Official Website: https://github.com/Gautam-Arora24/resize-observer-hook

License: MIT

Credit: Source link

Previous Next
Close
Test Caption
Test Description goes like this