1.0.2 • Published 3 years ago

use-window-dimensions v1.0.2

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

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