@hmn/use-window-size
TypeScript icon, indicating that this package has built-in type declarations

0.2.6 • Public • Published

@hmn/use-window-size

A hook that provides information of the dimensions of the window

Installation

npm install --save @hmn/use-window-size

Importing the hook

import useWindowSize from '@hmn/use-window-size'

Usage

const Demo = () => {
    const { innerWidth, innerHeight, outerHeight, outerWidth } = useWindowSize()

    return (
        <>
            <h1>Window dimensions</h1>
            <h3>Resize window to see changes</h3>
            <div>
                <div>innerWidth: {innerWidth}</div>
                <div>innerHeight: {innerHeight}</div>
                <div>outerWidth: {outerWidth}</div>
                <div>outerHeight: {outerHeight}</div>
            </div>
        </>
    )
}

render(<Demo/>)

Readme

Keywords

Package Sidebar

Install

npm i @hmn/use-window-size

Weekly Downloads

1

Version

0.2.6

License

UNLICENSED

Unpacked Size

19.2 kB

Total Files

70

Last publish

Collaborators

  • capjavert
  • humaninteraction