Answer the question
In order to leave comments, you need to log in
How to pass a function to a component in react?
There is a useState
const [menuTopActive, setMenuTopActive] = useState(false)
<Navbar topActive={menuTopActive} setTopActive={setMenuTopActive} />
<div className="burger-btn" onClick={function () {
setTopActive(!topActive)
}}>
<span/>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question