npm.io
1.0.0 • Published 6 years ago

react-hook-use-window-dimensions

Licence
MIT
Version
1.0.0
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
1

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>
    </>
  )
}

Keywords