Closed Koushik-Saha closed 4 years ago
Hey @Koushik-Saha,
You will need to manage the menu state externally, so you can update it as necessary on NavLink
clicks.
Here is an example of how to do that using the isOpen
prop: https://github.com/negomi/react-burger-menu/wiki/FAQ#i-want-to-control-the-open-state-programmatically-but-i-dont-understand-how-to-use-the-isopen-prop
can you show a example using <NavLink
NavLink
would be the a
elements in that example. Just pass an onClick
handler to them.
can i use 2nd example (react hooks) for my problem
Yes, they both demonstrate the same concepts, so you can use whichever you like.
i want to close my sidebar menu when a link is click not outside or cross button click just link click then my sidebar menu automatically close itself. But problem is my link is under another component , Suppose my component
<ShipForMe/>
and my link is under<ShipForMe/>
like<NavLink to="/dashboard/ship-for-me/my-request/pending">My Request</NavLink>
Sidebar.js
ShipForMe.js
Note:
isOpen{flase}
is not working, it is only working when link is physical there.