I have a display area(which is a div) where I rendered some text(using span ).I used map function to render the text from an array .
The problem is when I add color class to span inside map function every text gets the same color(I know why its happening) but I only want the specific text(single word I target) to take the color and the remaining will stay the same. Can't think of any solution for this .
[colorTrigger is the word that I want to color.] here is sample code -
<div className = "firstLine">
{display.map(word=>{
if(colorTrigger){
return (<span key={uuid()} className = "singleWord redColorWord" >{word}</span>)
}
return(<span key={uuid()} className = "singleWord" >{word}</span>)
})}
if (colorTrigger === word)?