@talves/use-window-size

0.1.1 • Public • Published

@talves/use-window-size

React hook (usePrevious)


Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

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

OR

yarn add @talves/use-window-size

Usage

/* using react ^17.0.1 */
import { useEffect } form 'react'
import { useWindowSize } from '@talves/use-window-size'

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

function ourFunctionalComponent({ ...props }) {
  const size = useWindowSize()

  React.useEffect(() => {
    // Do something with the size
  }, [size])

  ...
}

NOTE: This is a module package library for react using window. The choice is to resolve the import to lib/index.mjs. There is a commonjs version in dist/lib/use-window-size.js if someone needed.

Other Solutions

Plenty of other hooks out there.

Readme

Keywords

none

Package Sidebar

Install

npm i @talves/use-window-size

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

5.46 kB

Total Files

7

Last publish

Collaborators

  • talves