react-hook-viewport-size

    1.0.1 • 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

    Install

    npm i react-hook-viewport-size

    DownloadsWeekly Downloads

    36

    Version

    1.0.1

    License

    LGPL

    Unpacked Size

    10.3 kB

    Total Files

    5

    Last publish

    Collaborators

    • bence.a.toth