A custom React hook that leverages the ResizeObserver API to track and measure the dimensions of an element.
To install the package, use npm:
pnpm add use-size-observer
yarn install use-size-observer
npm install use-size-observer
import { useSizeObserver } from 'use-size-observer';
const [ref, size] = useSizeObserver();
console.log(size);
return <div ref={ref}>...</div>
Bundle your TypeScript library with no config, powered by esbuild.
- install dependencies
# pnpm
$ pnpm install
# yarn
$ yarn install
# npm
$ npm install
- Add your code to
src
- Add export statement to
src/index.ts
Message - Test build command to build
src
. Once the command works properly, you will seedist
folder.
# pnpm
$ pnpm run build
# yarn
$ yarn run build
# npm
$ npm run build
- Publish your package
$ npm publish