We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c0faba2 commit 0cab63fCopy full SHA for 0cab63f
playground/src/app/home/page.tsx
@@ -3,6 +3,7 @@
3
import AuthInitializer from "@/components/authInitializer"
4
import { isMobile } from "@/common"
5
import dynamic from 'next/dynamic'
6
+import { useEffect, useState } from "react"
7
8
const PCEntry = dynamic(() => import('@/platform/pc/entry'), {
9
ssr: false,
@@ -13,10 +14,16 @@ const MobileEntry = dynamic(() => import('@/platform/mobile/entry'), {
13
14
})
15
16
export default function Home() {
17
+ const [mobile, setMobile] = useState<boolean | null>(null);
18
+
19
+ useEffect(() => {
20
+ setMobile(isMobile())
21
+ })
22
23
return (
24
+ mobile === null ? <></> :
25
<AuthInitializer>
- {isMobile() ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
26
+ {mobile ? <MobileEntry></MobileEntry> : <PCEntry></PCEntry>}
27
</AuthInitializer >
28
);
29
}
0 commit comments