I am currently working on a project in React where I'm iterating over an array of objects and displaying each object in its own card on the screen. Each object in the array has a unique hex color property, and my goal is to dynamically set the font color of each card using Sass/CSS based on the color value stored in the object. However, I am struggling to find a way to pass this color value to my stylesheet.
// Defining the array I'm mapping over
const data = [
{
title: 'this is the title of object one',
color: #979696
},
{
title:'this is the title of object two',
color: #8C64E6
}
]
// Component to render individual cards
const Card = (props) => (
<h3 className='title'>{props.title}</h3>
)
// CSS
.title {
color: ????;
}