React hook for getting the current window size

Here's a simple React hook that will give you the current window size. By initializing the width/height values as undefined and then updating state in useEffect we ensure that the hook can be used within server-rendered apps (which won't have a window object on server-render).

Trending on Indie Hackers
How long did it take to build your MVP? 35 comments Dealing with lack of motivation due to failed soft launch 27 comments Bootstrapped my productivity app to 700 paying customers! AMA. 21 comments I watch how IH is turning into a marketing sink, and I feel sad :( 7 comments Free e-mail countdown timer that doesn't suck 💩 6 comments Return of the external link 5 comments