About
This React hook returns the current window width.
Install
npm i window-width-react-hook
Or
yarn add window-width-react-hook
Usage
-
Include the hook:
import useWindowWidth from 'window-width-react-hook';
-
Use it where is needed:
function App() { return ( <div> Current width: {useWindowWidth()}px </div> ); }
License
Licensed under the MIT License, Copyright © 2021 AlexWebLab