Skip to content

Is there any way to observer the popupState?  #123

@tamdc

Description

@tamdc

I need to catch the state change of submenu level 3 to change CSS property of lvl2. Each has their own popupState.

<MenuItemLv1 {...bindHover(lvl2MenuState)}>
    <Typography>Lv1 menu item</Typography>
    <Lvl2Menu
          transformOrigin={{ horizontal: 48, vertical: -48  }}
          {...bindMenu(lvl2MenuState)}
    >
         {lvl2menuItems.map(renderLv2MenuItem)}
    </Lvl2Menu>
</MenuItemLv1>

<MenuItemLv2 {...bindHover(lvl3MenuState)}>
    <Typography>Lv2 menu item</Typography>
    <Lvl3Menu
           anchorOrigin={{ horizontal: 'right', vertical: 'top' }}
           transformOrigin={{ horizontal: -24, vertical: 'top' }}
          {...bindMenu(lvl3MenuState)}
    >
         {lvl3menuItems.map(renderLv3MenuItem)}
    </Lvl3Menu>
</MenuItemLv2>

Do we have a prop callback that whenever the popupState change we can trigger the function passed through?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions