I saw similar questions in here, but they aren't addressing this specific issue.
I have a react function component like this,
function Overlay() {
return <div className="off"></div>;
}
I want to change its className property later based on a click event that occurs on a Btn element. Note that the Btn element isn't a parent or a child of the Overlay element.
function Btn() {
return <button onClick={changeOverlayProperty} ></button>;
}
So, what should "changeOverlayProperty" do to achieve the result? Is there any "react way" to do it other than relying on the usual element methods such as "getElementsByClassName"? Giving actual codes will be helpful as I'm totally new to ReactJS.