I want to click a button and set the value of a variable to something specific. The issue is that I have two buttons in two different components that I want to be able to modify this variable. Is this a scope issue? Am I using components wrong? Here is my example code, sorry for such a weird example, my real project is way too long.
import "./styles.css";
export default function App() {
return (
<div className="App">
<Header/>
<Article/>
</div>
);
}
function Header() {
// const [open, setOpen] = useState(false);
//use with setOpen(true)
return (
<header>
<nav>
<button onClick={null}>
red
</button>
</nav>
<div id="title">
<h1>Title Here!</h1>
</div>
</header>
);
}
function Article(){
return(
<article>
<p>qwertyuiop</p>
<button onClick={null}>
blue
</button>
</article>
)
}