Manasvini Ganesh
Manasvini Ganesh

Reputation: 523

How to collapse a menu in metismenu react js while active link is set as another link?

The structure of my menu is as follows : enter image description here

The default page is Home. And on clicking any menu even sub-menu that particular menu option should be highlighted. This I am able to achieve by

<MetisMenu
        ref={(r) => { this.menu = r; }}
        activeLinkFromLocation
        classNameItemHasVisibleChild="open"
        className="menu"
        onSelected={(e) => {
          {/* e.preventDefault();console.log('onSelected', e);*/}
        }}
        content={menu1}
      />

What I need to implement in addition is that by default Menu 1.1 and Menu 1.2 should collapse but the active link should still be based on the page's address.

Upvotes: 1

Views: 644

Answers (0)

Related Questions