Ionic 5 React - How to prevent pushing the current page again?

When I click an item (with routerLink set) in the side menu the page is pushed into the history even if that page is already being shown. How can I prevent that?

in the menu, ignore the click if that is already the current path, you can check the current path with useLocation() hook

1 Like