Next.js
Share
Flag
Related
[antd: Message] You are calling notice in render which will break in React 18 concurrent mode. Please trigger in effect instead.
I'm getting this error when using MessageWarning: [antd: Message] You are calling notice in render which will break in React 18 concurrent mode. Please trigger in effect instead.Here is my code:import { message } from 'antd';
export default function Page() {
const [messageApi, contextHolder] = message.useMessage();
const res = await fetch("/api/...", {
method: "POST",
});
if (!res.ok) {
messageApi.error("Error! Fail to login!");
}
return (
<Home>
...
</Home>
)
}
2024-07-21 00:08:18