Closed nyousefzai closed 3 years ago
solution:
since nextjs renders component on server side, it needs to turn off the ssr mode
anyone who runs to the same issue please use import dynamic from "next/dynamic"
and ssr:false
hope this helps other foks!
solution:
since nextjs renders component on server side, it needs to turn off the ssr mode
anyone who runs to the same issue please use import dynamic from
"next/dynamic"
andssr:false
hope this helps other foks!
hello ,how to import chatui/core ? please give me a example
import Chat, { Bubble, useMessages } from "@chatui/core";
if use this code , get window not defined!
solution :
take your component out of pages folder
use next/dynamic to import this component
like
const Chat = dynamic(
() => {
return import("../../components/chat");
},
{ ssr: false }
);
What problem does this feature solve? (这个功能解决了什么问题) When using with next js project you get window not defined! node_modules/@chatui/core/lib/utils/canUse.js (30:30)
Describe the solution you'd like (描述您想要的解决方案) it should work with next js
What does the proposed API look like? (你期望的 API 是怎样的)