How i can use history or push to new url in <ion-menu /> while it's placed outside <ionRouterOutlet />?

<IonApp>
      <IonReactRouter>
        <MenuSide />
        <IonRouterOutlet>
          <Route
            path="/home"
            render={(props) => {
              return <HomePage {...props} />
            }}
          />
       </IonReactRouter>
</IonApp>

You can use the useHistory hook.

1 Like

It’s will be undefined. Cannot replace or push of undefined. Maybe it isn’t work

It won’t work if you’re trying to use it in IonApp. It does work if you use it in a component that’s inside the router in the component tree.

2 Likes