[英]React + .jsx + Spread Operator — Add a Style?
我有一個React元素(由出色的Downshift庫提供)看起來像這樣:
<mySearchResults
{...{
inputValue,
selectedItem,
highlightedIndex,
getItemProps,
}}
/>
我需要添加一個.jsx樣式:
style: styles.searchResultsContainer
我嘗試了幾種添加方式,包括:
<mySearchResults
{...{
inputValue,
selectedItem,
highlightedIndex,
getItemProps,
style: styles.searchResultsContainer
}}
/>
它的構建和運行沒有錯誤,但似乎並未將樣式納入元素。
正確的語法是什么?
那應該是正確的。 您確定將mySearchResults
組件設置為接受樣式道具嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.