Eu retorno o valor dinâmico do banco de dados como dados JSON. Não consigo definir o valor da tag backgroundImage. Eu tentei código no golpe
images = imageList.map(img => {
return (
<div
key={img.id}
style={{
backgroundImage: `https://blabla.com/image/${img.icon}` //Don't work
}}>
</div>
);
}); }
você precisa usar a sintaxe css com backgroundImage
images = imageList.map(img => {
return (
<div
key={img.id}
style={{
backgroundImage: `url("https://blabla.com/image/${img.icon}")` //Should work
}}>
</div>
);
}); }
Este artigo é coletado da Internet.
Se houver alguma infração, entre em [email protected] Delete.
deixe-me dizer algumas palavras