0.0.18 • Published 5 years ago

@burst/react-use-window-size v0.0.18

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 years ago

@burst/react-use-window-size

React custom hook to get viewport width and height on init and resize

installation

npm i @burst/react-use-window-size

Example

import React from 'react'
import { useWindowSize } from '@burst/use-window-size'

const Component = () => {
  const { viewportWidth, viewportHeight, documentWidth, documentHeight } = useWindowSize()

  return (
    <div>
      {viewportWidth}x{viewportHeight}px
    </div>
  )
}

export default Component

Mobile check is done to prevent a resize event trigger when safari url bar change. So using orientationchange on mobile devices. A throttle is used to prevent too many resize events.

0.0.18

5 years ago

0.0.17

5 years ago

0.0.1-6.1

5 years ago

0.0.14

5 years ago

0.0.15

5 years ago

0.0.16

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.1

5 years ago