How do I change/add/remove style attributes in React? I am used to query selector but I understand that isn't the best way due to state changes in React. In general how do i access style attributes in react and change them from another element event?
const elements = document.querySelectorAll(".option-item")
function changeBackground() {
elements.style.background = "red"
}
<div className="options-panel" onMouseOver={changeBackground}>
<div className="option-item">1</div>
<div className="option-item">2</div>
<div className="option-item">3</div>
<div className="option-item">4</div>
</div>
.options-panel{
background-color:black; //<<---when i hover over this corresponding element
}
.option-item{
background-color:blue //<<---all elements with this classname change to "red"//
}