Closed MarkLyck closed 2 years ago
Hello @MarkLyck. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by Need Reproduce
will be closed if no activities in 3 days.
你好 @MarkLyck, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。
如果使用nextjs 13最新的app目录,任何antd组件都会是这个错误(包括@ant-design/icon等),只能在client components中使用。比如下面会出错:
/* /app/page.tsx */
import {Button} from 'antd';
export default function Page(){
return <Button>ok</Button>
}
下面就正常:
/* /app/page2.tsx */
‘use client';
import {Button} from 'antd';
export default function Page(){
return <Button>ok</Button>
}
还有任何组件的props中包含function也不能用(比如onClick,Pagination中的renderItem等)
可以参看nextjs文档:beta.nextjs.org
Reproduction link
https://nextjs.org/examples
Steps to reproduce
Attempt to render an antd Table in a React server component.
What is expected?
It should render the Table without throwing an error.
What is actually happening?
An error is thrown: