我正在尝试仅在 acollections
存在时渲染标题,而在它为空时不渲染它。一个简单的修复,但我一直收到这个 Unexpected Token 语法错误,我似乎找不到问题。任何帮助将不胜感激,因为这是我第一次发布和使用 react-native!
const collectionsHeaderHandler = ({ favorites }) =>
{favorites.meta.collections} ?
{copyDek.FavoritesLayout.collectionsHeader} :
"";
const FavoritesLayoutCollections = ({ favorites, onPressHandlers }) => (
<FavoritesLayoutCollectionsWrapper>
<FavoritesLayoutCollectionsHeader>
{collectionsHeaderHandler}
</FavoritesLayoutCollectionsHeader>
<FavoritesCollections
collections={favorites.meta.collections}
onPressCollection={onPressHandlers.onPressCollection}
/>
</FavoritesLayoutCollectionsWrapper>
);