<Popper
keepMounted
onMouseMove={() => console.log("asd")}
open={openSubMenu}
anchorEl={anchorSubMenuEl}
placement="right"
transition
>
{textSubMenu &&
(({ TransitionProps }) => (
<Fade {...TransitionProps} timeout={350}>
<PopperContainer>{textSubMenu}</PopperContainer>
</Fade>
))}
</Popper>
Event Listenershttps://popper.js.org/docs/v2/lifecycle/#event-lis...
You can also have Popper automatically update the position when certain events are fired, to learn more visit the Event Listeners Modifier page.
Hook into the lifecycle
There are situations where you may need to hook into the Popper's lifecycle to perform some additional logic.
If all you need is a callback ran after Popper positioned the element the first time, you can define the onFirstUpdate property in the Popper options:
createPopper(referenceElement, popperElement, { onFirstUpdate: state => console.log('Popper positioned on', state.placement), });
If, instead, you want to run some logic on each update cycle, the best way to do that is to define your own custom modifier.
If you want to make sure to run your logic after all the other modifiers have ran, we suggest to set afterWrite as your custom modifier's phase.
popperOptions - Options provided to the Popper.js instance.https://mui.com/api/popper