1.0.2 • Published 2 years ago

use-window-hook v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

use-window-hook

This is a very simple hook for get window size easily.You can get the width and height size in pixel.Based on this you can do so many custom css style.

example

const [height,width] = useWindowSize();

Install

npm i use-window-hook

Usage

import useWindowSize from 'use-window-hook';

function App() {
  const [height, width] = useWindowSize();

  return (
    <div className="App">
      <h3>Height: {height}</h3>
      <h3>width: {width}</h3>
      <div className="row">
        <div className={`col-md-6 ${width <= 430 && "mt-5"}`}>
          <h1>Use Window Size</h1>
        </div>
      </div>
    </div>
  );
}

export default App;