Skip to content

Commit

Permalink
Add SSR check
Browse files Browse the repository at this point in the history
  • Loading branch information
oddsson committed Jan 6, 2025
1 parent 47e3f43 commit 9043af2
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const useIsMobile = () => {

useEffect(() => {
const checkMobile = () => {
// Check for SSR
if (!window) {
return false
}

const userAgent = navigator.userAgent
const mobileRegex =
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i
Expand Down

0 comments on commit 9043af2

Please sign in to comment.