use-window-dimensions

1.0.2 • Public • Published

Hook use-window-dimensions

Um hook para receber, em tempo real, os tamanhos horizontal e vertical da tela.


Instalação


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

Como usar


import React from 'react';

import useWindowDimension from 'use-window-dimensions';

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

  console.log("width: " + width + "height: " + height);
  
  return (
    <div>
      <h1>Height: {width} | Width: {height}</h1>
    </div>
  );
}

Package Sidebar

Install

npm i use-window-dimensions

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

1.98 kB

Total Files

3

Last publish

Collaborators

  • pedrovasalmeida