我有一個陣列messages,Alert如果 Status 為 true,則嘗試呈現不同的結果,但它不會在瀏覽器中呈現。
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>
);
uj5u.com熱心網友回復:
請記住,此map()函式不會回傳任何內容,因為它的內容在大括號中{}而不是圓括號中()。您也可以使用return item.status ? ....
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/399030.html
標籤:javascript 反应 打字稿 蚂蚁
