1.0.2 • Published 2 years ago

react-hook-viewport-size v1.0.2

Weekly downloads
8
License
LGPL
Repository
github
Last release
2 years ago

react-hook-viewport-size :straight_ruler:

A React hook for detecting viewport size.

Installation

Using npm:

npm install --save react-hook-viewport-size

Using yarn:

yarn add react-hook-viewport-size

Usage

import React from 'react'
import useViewportSize from 'react-hook-viewport-size'

const ComponentWithViewportSize = () => {
  const [viewportWidth, viewportHeight] = useViewportSize()

  return (
    <p>Viewport size: {viewportWidth} × {viewportHeight}</p>
  )
}

Contributions

Contributions are welcome. File bug reports, create pull requests, feel free to reach out at tothab@gmail.com.

Licence

LGPL-3.0