Created
January 15, 2024 07:03
-
-
Save ryanmorr/aa3a33eedd7a97905b28d09d87ce41a3 to your computer and use it in GitHub Desktop.
Are we on the client or the server?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isBrowser() { | |
return typeof window != 'undefined' && typeof window.document != 'undefined'; | |
} | |
function isServer() { | |
return typeof process != 'undefined' && {}.toString.call(process) == '[object process]'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment