Code AnalysisIntermediate 45s
React custom hook
What does this hook do?
Starter code
function useWindowSize() {
const [s, ss] = useState({ w: 0, h: 0 });
useEffect(() => {
const h = () => ss({ w: window.innerWidth, h: window.innerHeight });
window.addEventListener("resize", h);
return () => window.removeEventListener("resize", h);
}, []);
return s;
}Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.