I'm fairly new to React, and I'm building out a dropdown navigation menu that toggles on hover. I need to know what best practices would be for toggling this menu.
Currently I'm using state to toggle a data
attribute that I can reference in the CSS ie data-menu="open"
for the mobile menu. Should I be doing it this way, or should I use state to toggle the menu open and closed?
Thanks in advance, I'd love anyone's input here.
You don't need to use react for that you could just use an :hover
css selector
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.