我将
primereact
与 nextjs
一起使用,但出现错误 Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.
。所以我猜 dialog
组件正在使用一些 ref
但我不知道如何解决这个问题,该对话框包含一个表单,并且无论错误如何,该表单实际上都是有效的,可以安全地忽略它吗?
Table.js
const Table = ()=>{
const [userDialog, setUserDialog] = useState(false);
const openCreateUserDialog = () => {
setUserDialog(true);
};
const leftToolbarTemplate = () => {
return (
<div className="flex flex-wrap gap-2">
<Button
label={t("adminTeamPage.new.title")}
icon="pi pi-plus ml-1"
severity="success"
onClick={openCreateUserDialog}
/>
</div>
);
};
return(
<CreateUser userDialog={userDialog} setUserDialog={setUserDialog} />
)
}
CreateUser.js
const CreateUser = ({ userDialog, setUserDialog })=>{
return(
<Dialog
visible={userDialog}
header={t("adminTeamPage.new.title")}
modal
onHide={() => {
if (!userDialog) return;
setVisible(false);
}}
className="p-fluid container-md px-0"
>
<p> some dialog content
</Dialog>
)
}
npm install --save-dev @ant-design/v5-patch-for-react-19