[英]React Typescript: Ant Design Alert not rendering
I have an Array messages
and try to render different Alert
if the Status is true but it dont render in the Browser.如果状态为真,我有一个数组
messages
并尝试呈现不同的Alert
,但它不会在浏览器中呈现。 Console.log(message)
has shown that the message
is not empty. Console.log(message)
显示message
不为空。
return (
<Space direction="vertical" >
{messages.map(item => {
item.status ?
<Alert
message={item.title}
description={item.statusMessage}
type="success"
showIcon
/> :
<Alert
message={item.title}
description={item.statusMessage}
type="error"
showIcon
/>
})}
</Space>
);
Please bear in mind that this map()
function will not return anything, because its content is in curly brackets {}
and not parentheses ()
.请记住,此
map()
function 不会返回任何内容,因为它的内容在大括号{}
而不是括号()
中。 You could also use return item.status? ...
你也可以使用
return item.status? ...
return item.status? ...
. return item.status? ...
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.