Я пытаюсь пропустить фоновое изображение через подставку, и оно не работает, оно говорит, что url не определено.
url
const CardImage = styled.div` height: auto; width: 100%; background-size: contain; background: url(${props => props.data.url}); ` function Card(props) { return ( <CardImage/> ) } <Card data={{url: "https://via.placeholder.com/150x150", text: "test"}}/>
Вы никогда не передадите реквизит от Card до <CardImage/>:
Card
<CardImage/>
function Card(props) { return <CardImage {...props} />; }
function Card(props) { const style = { height: "150px", width: "150px", backgroundImage: `url(${props.data.url})`, backgroundRepeat: "no-repeat" }; return <div style={style}>Background</div>; }