I am looking for a way to randomly change the background color of each element
However, when I try to implement it in the code below, the background color ends up being transparent:
{
modules.map((module, index) => (
<div className='carousel-module shadow'
style={{ background: "#" + Math.floor(Math.random()*16777215).toString(16)}}
>
<p className='module-element-text'>{module.name ? module.name : "N/A"}</p>
<p className='module-element-text'>{module.code ? module.code : "N/A"}</p>
<Button onClick={() => setShow(false)}
variant="success" className='modules-list-button'>
Load
</Button>
</div>
))
}
I would appreciate any suggestions on how to successfully achieve this feature