Can someone assist me in changing the background color of a selected item from a list and retrieving the value of the selected item? Any help would be greatly appreciated. Thank you!
Below is the code for my Component:
const Time = () => {
const dataTime = useMemo(() => TimeData, []);
const chunks = useMemo(() => {
const _chunks = [];
const tmp = [...dataTime];
while (tmp.length) {
_chunks.push(tmp.splice(0, 3));
}
//console.log(_chunks);
return _chunks;
}, [dataTime]);
return (
<div className="Main-Section">
<div className="First-Section">Time</div>
<div className="Second-Section">
<div className="date_title">Wednesday , June 13</div>
<div className="time_Slots">
{chunks.map((timeslot) => {
return (
<div key={timeslot} className="inline">
{timeslot.map((time) => {
return <p className='timeslots' key={time}>{time}</p>;
})}
</div>
);
})}
</div>
<div className='new_Date'>PICK A NEW DATE</div>
</div>
</div>
);
};