0
I have a Semaphore component that calls the Light component 3 times each with its parameter
<div className="compSemaforo">
<Luz color="red" />
<Luz color="yellow" />
<Luz color="green" />
</div>
how I can at the root of the Light component identify what the class value is and add a specific class for each of the calls?
Rebound that always the 3 components <Luz />
will be rendered each with a specific class that will change your background
and I’ve tried to use map
and it didn’t work
It is not very clear what you are trying to do. What is this class you are mentioning? The property
color
would be that class? And why are you using the methodmap
to generate a static JSX?– Andre
Is there a way you can illustrate with your code, and why you need to identify? Is there a process you want to do? Maybe the Light component just needs to change the color (I’m almost understanding)?
– novic
I am doing a sefamofo where there is the class Semaforo which is the one I put up and this class calls the Light Component which is just a component called 3 times to represent each color of the semaphore I am passing color="red" to is identifying what your color will be with this I am trying to receive this value in the Light Jam and thus perform the treatment to add the right color as background of the element
– Tarcisio Silva
Show your code and you want to keep changing colors?
– novic
Please add the code of your Light component to make it clearer what the problem is!
– Guilherme Lemmi