react-hook-viewport-size

1.0.2 • Public • Published

react-hook-viewport-size 📏

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

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i react-hook-viewport-size

    Weekly Downloads

    8

    Version

    1.0.2

    License

    LGPL

    Unpacked Size

    10.3 kB

    Total Files

    5

    Last publish

    Collaborators

    • bence.a.toth