[英]TypeError: Cannot set properties of undefined (setting 'hook')
TypeError: Cannot set properties of undefined (setting 'hook')类型错误:无法设置未定义的属性(设置“钩子”)
I am working on a Nextjs application but getting this error with antd library.我正在开发 Nextjs 应用程序,但在使用 antd 库时出现此错误。 I'm using the modal component and tooltip component which causes a re-render on open and close and spits out this error multiple times.
我正在使用模态组件和工具提示组件,这会导致在打开和关闭时重新渲染并多次吐出此错误。 Same goes for the tooltip when I mouse over it.
当我将鼠标悬停在它上面时,工具提示也是如此。 Has anyone experienced this?
有没有人经历过这个? and how did you fix it?.
你是怎么解决的? Answers appreciated!
回答赞赏!
import { Button, Modal, Tooltip } from 'antd'; import { Button, Modal, Tooltip } from 'antd';
const [isModalOpen, setIsModalOpen] = useState(false);
<div className="d-flex gap-2">
<Tooltip title="Edit">
<EditOutlined className="h5 pointer text-warning" />
</Tooltip>
<Tooltip title="Publish">
<CheckOutlined className="h5 pointer text-success ml-2" />
</Tooltip>
</div>
<Button
className="w-100"
onClick={() => setIsModalOpen(true)}
type="primary"
shape="round"
size="large"
icon={<UploadOutlined />}
>
Open modal
</Button>
<Modal
title="Modal title"
centered
open={isModalOpen}
onCancel={() => setIsModalOpen(false)}
footer={null}
>
<p>Some contents...</p>
</Modal>
enter image description here在此处输入图像描述
I had the same error when using antd file upload.我在使用antd文件上传时出现了同样的错误。
But it was introduced by one of the Chrome extensions, not antd.但它是由 Chrome 扩展之一引入的,而不是 antd。
Refreshing the Chrome extension will remove this error.刷新 Chrome 扩展程序将消除此错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.