I have been implementing zego cloud to my next js application, it throws error which shows document is not defined
I am using the "use client" in my next js application to access react hooks and DOM of the browser but it throws document is not defined
i use Nextjs like you and i has the problems like you
you must to do like this, import zegocloud in function
// example this is function
const invite = async () => {
const { ZegoUIKitPrebuilt } = await import(
'@zegocloud/zego-uikit-prebuilt'
)
const TOKEN = ZegoUIKitPrebuilt.generateKitTokenForTest(
appID,
serverSecret,
roomID,
userID,
userName,
)
// your logic code
}
or another answers
How to fix 'ReferenceError: document is not defined' when using ZEGOCLOUD API with Next.js?