useWindowSize
React Element Hooks that tracks window size.
Usage
import { useWindowSize } from "@reactuses/core";
const Demo = () => {
const { width, height } = useWindowSize();
return (
<div>
<p>
width: {width}, height: {height}
</p>
</div>
);
};
Example
width: 0, height: 0
Type Declarations
export interface WindowSize {
width: number
height: number
}
export default function useWindowSize(): WindowSize