react-hook-use-window-dimensions

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i react-hook-use-window-dimensions

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

3.62 kB

Total Files

5

Last publish

Collaborators

  • hashdot