If you could help me with this one that would be very helpful as I spent many hours on it.
I've got array of hours, I'm mapping it and returning list items. The thing is that I want to highlight/color only those items which are in the other array(hours2).
Here's chunk of my code:
const hours = ["09:00", "10:00", "11:00", "12:00", "13:00", "14:00"];
const hours2 = ["11:00", "12:00"];
const renderedHours = hours.map(item => (
<li
style={{
backgroundColor: item === hours2.map(item => item) ? "yellow" : "pink"
}}
// above I would like to select only those items which are equal to items from second array, but that does not work.
key={item}
className="hoursListItem"
onClick={e => {
this.handleClick(e);
}}
>
{item}
</li>
));
Thank you in advance!