![](/img/trans.png)
[英]jQuery Define a Global Variable for an element that does not yet exist in DOM
[英]How to transition an element that does not exist on the DOM yet
現在我有這樣的代碼
{data.inventoryOn === true ? (
<div className="inventoryOptions flex__container-v">
<Link to="listofmedicines" style={{ textDecoration: "none" }}>
<div className="inventoryoption">
<p className="p__poppins">List Of Medicines</p>
</div>
</Link>
<Link to="medicinegroups" style={{ textDecoration: "none" }}>
<div className="inventoryoption">
<p className="p__poppins">Medicines Groups</p>
</div>
</Link>
</div>
) : null}
{data.spaceBelow ? <div className="space" /> : null}
正如您可能已經注意到的那樣,代碼的顯示取決於某些 state 值是否為真。
我的問題是如何讓它看起來更平滑。 我無法轉換它,因為我不知道背景或顏色或其他屬性。 並且內容不會隱藏,因為當 state 值不正確時,它完全不可用。
我怎樣才能做到這一點?
如果堅持使用條件渲染,可以根據react使用css animation和onAnimationEnd prop,這個snippet中有實現
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.