show item window width react code example
Example 1: how to get window size in react js
const Component = () => {
const { height, width } = useWindowDimensions();
return (
<div>
width: {width} ~ height: {height}
</div>
);
}
Example 2: react js get screen size
console.log(window.innerHeight);