styled-componentで渡された小道具に 's'文字列を追加しようとすると問題が発生しました。また、スタイリッシュなコンポーネントでちょうどprop.x
を使用できるかどうかは完全にはわかりません。ここで私の意味は次のとおりです。Stylat-componentの文字列を含むConcat prop値
const MyComponent = (props) => {
const StyledLineItem = styled.li`
animation: ${someAnime};
animation-delay: ${props.x}; // <- will this work?
// here i need to add the 's' to the end
// but i can't use `` becaouse of the fact that styled components
// are in a template tag already... at least i think that's why
// i get errors when i try `${props.x}s`
// also, i haven't tested but will using ${prop.x} in a styled-component
// like this even work?
`
return (
<StyledLineItem>{props.text}</StyledLineItem>
)
}
// in my main component...
// ... react component stuff
render() {
return (
<ul>
{_.map(data, (item, i) => <MyComponent key={i} text={item.text})}
</ul>
)
}
私は何かに明確にすることができた場合、私に教えてください。
私は最初に、いくつかの理由のために、それは動作しませんでした試みた...しかし、今それはありません! Mustaはもっと大きな問題やタイプを持っていました... Thanks Ekkasit! – archae0pteryx