react-hook-use-window-dimensions
v1.0.0
Published
Get Browser Window Dimensions
Downloads
14
Readme
React Hook - useWindowDimensions
Get Browser Window Dimensions
Install
npm i react-hook-use-window-dimensions
Usage
Simply use the hook and get the dimensions.
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>
</>
)
}