README
@wbe/use-window-size
This React hook allow to get dynamically window dimensions.
Installation
$ npm install -s @wbe/use-window-size
How to use
import { useWindowSize } from "@wbe/use-window-size";
const App = () => {
// get window size
const { width, height } = useWindowSize();
// Resize your browser and check width & height change.
return (
<ul>
<li>window width: {width}</li>
<li>window height: {height}</li>
</ul>
);
};
Returned
The hook return object who contains window dimensions:
{
"width": number,
"height": number
}