1.0.0 • Published 4 years ago

react-hook-use-window-dimensions v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

React Hook - useWindowDimensions

NPM

Get Browser Window Dimensions

Install

npm i react-hook-use-window-dimensions

Usage

Simply use the hook and get the dimensions.

Demo:

Edit Demo

Example.js

import React from "react"
import useWindowDimensions from "react-hook-use-window-dimensions"

export default function ExampleComponent({ children }) {
  const { width, height } = useWindowDimensions()
  return (
    <>
      <p>width: {width}</p>
      <p>height: {height}</p>
    </>
  )
}