3
0 Comments

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 I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 28 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 15 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments