Check if client JS is available

🔥 If you’re working with SSR React/Vue it’s handy to know if you’re in a client-JS context or not.

This little snippet will return true if you’re in the browser and false if you’re on the server.

Code that reads: isClientJSAvailable() { return typeof window !== "undefined" }

Hi đź‘‹
I’m Andy, a freelance web designer

I’m not currently booking new projects, but you can support my work by buying “Every Layout”.

Buy Every Layout