use-screen-dimensions
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Hook use-screen-dimensions

Custom react hook to get current window/screen dimensions


Installation


  • npm:
npm install use-screen-dimensions
  • yarn:
yarn add use-screen-dimensions

How to use


import React from "react";

import {useScreenDimensions} from "use-screen-dimensions";

const Component: React.FC = () => {
  const { width, height } = useScreenDimensions();

  console.log("width: " + width + "height: " + height);

  return (
    <div>
      <h1>
        Height: {width} | Width: {height}
      </h1>
    </div>
  );
};

Package Sidebar

Install

npm i use-screen-dimensions

Weekly Downloads

8

Version

1.2.0

License

ISC

Unpacked Size

3.13 kB

Total Files

5

Last publish

Collaborators

  • amendezm