DEV Community

Marios T.
Marios T.

Posted on

How do I change the state of sibling items on button press?

Hello.

I'm trying to inverse the status of each button text.

Here's what I'm trying to do:

https://codesandbox.io/s/mystifying-sanderson-h3g43

By default "red" is on and the others are "off".

I want when I press on "green" red and blue to be off.

I don't know how to do this in both JS and React.

Thanks.

Top comments (0)