Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

useScreenWidth

import { useEffect, useState } from ’react’;

export function useScreenWidth(): number {
  const [width, setWidth] = useState(window.innerWidth);

  useEffect(() => {
    const handler = (event: any) => {
      setWidth(event.target.innerWidth);
    };

    window.addEventListener(’resize’, handler);

    return () => {
      window.removeEventListener(’resize’, handler);
    };
  }, []);

  return width;
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: declare function iwth interface typescript 
Typescript :: $clients = User::query()-where("type","client" ) 
Typescript :: group list into sublists python 
Typescript :: components of .net framework 
Typescript :: destroy object on collision phaser 
Typescript :: apply limit to fetch number of documents firebase firestore 
Typescript :: claire betts facebook 
Typescript :: nunjucks if logical or 
Typescript :: extracts lists from list python 
Typescript :: typescript default value null or undefined 
Typescript :: the html element that houses all html element that contains meta information about the web page,importing external stylesheets and internal ces 
Typescript :: splice typescript array 
Typescript :: split a column of lists pandas 
Typescript :: ionic google map 
Typescript :: how to make the inputs become a sum python 
Typescript :: requests python-passlib python-pil -y ubuntu 18.04 
Cpp :: how to make i/o fast in c++ 
Cpp :: sfml mouse position 
Cpp :: print std map 
Cpp :: iterator on std::tuple 
Cpp :: how to print a decimal number upto 6 places of decimal in c++ 
Cpp :: check if intent has extras 
Cpp :: check compiler version c++ 
Cpp :: infinity c++ 
Cpp :: ue4 c++ array 
Cpp :: 3d array in c++ 
Cpp :: program to convert int to int array c++ 
Cpp :: temporary mobile number 
Cpp :: 2d vector initialization in cpp 
Cpp :: number to binary string c++ 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =