@andreyradkevichasap/use-screen-width

The reason why I've created this hook , was problem which I've met when I used other existing hooks , and there was problem in getting width and height on different devices and it wasn't working on rotation changing event, etc . This hooks works properl

Usage no npm install needed!

<script type="module">
  import andreyradkevichasapUseScreenWidth from 'https://cdn.skypack.dev/@andreyradkevichasap/use-screen-width';
</script>

README

The reason why I've created this hook , was problem which I've met when I used other existing hooks , and there was problem in getting width and height on different devices and it wasn't working on rotation changing event, etc . This hooks works properly for each device. It is tested on my own project . Hope it will help to someone .

Edit use-screen-width-hook
import useScreenWidth from "@andreyradkevichasap/use-screen-width";

const YourComponent = () => {
  const { width, height } = useScriptLoader();

  //.... using height and width inside your component
};