# Routing with Tab does not work properly

**URL:** <https://forum.ionicframework.com/t/routing-with-tab-does-not-work-properly/221848>\
**Category:** Ionic React\
**Created:** [March 29, 2022, 1:27pm UTC](https://forum.ionicframework.com/t/routing-with-tab-does-not-work-properly/221848 "2022-03-29T13:27:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![aaronksaunders](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/aaronksaunders/32/13729_2.png) [@aaronksaunders](https://forum.ionicframework.com/u/aaronksaunders)\
**Post date:** [March 29, 2022, 10:06pm UTC](https://forum.ionicframework.com/t/routing-with-tab-does-not-work-properly/221848/2 "2022-03-29T22:06:47Z")

</div>

I would suggest you start with the tabs template and then add the authentication pages… it looks like you have the routing setup wrong.

But this is something that I see a lot of folks struggle with the first time, I really think there needs to be a template with the Tabs on their own file… SO that is what I got for you here.

> **[ionic-reactv6-tabs-login-route - CodeSandbox](https://codesandbox.io/s/ionic-reactv6-tabs-login-route-4hocxg)**
>
> ionic-reactv6-tabs-login-route by aaronksaunders using @ionic/react, @ionic/react-router, react, react-dom, react-router, react-router-dom, react-scripts

```auto
//App.tsx

  <IonApp>
    <IonReactRouter>
      <Route exact path="/">
        <Redirect to="/tabs/tab1" />
      </Route>
      <Route exact path="/login">
        <Login />
      </Route>
      <Route path="/tabs">
        <TabRoot />
      </Route>
    </IonReactRouter>
  </IonApp>

```

then your `TabRoot` Component

```auto
// TabRoot
const TabRoot: React.FC = () => (
  <IonTabs>
    <IonRouterOutlet>
      <Route exact path="/">
        <Redirect to="/tabs/tab1" />
      </Route>
      <Route exact path="/tabs/tab1">
        <Tab1 />
      </Route>
      <Route exact path="/tabs/tab2">
        <Tab2 />
      </Route>
      <Route path="/tabs/tab3">
        <Tab3 />
      </Route>
    </IonRouterOutlet>
    <IonTabBar slot="bottom">
      <IonTabButton tab="tab1" href="/tabs/tab1">
        <IonIcon icon={triangle} />
        <IonLabel>Tab 1</IonLabel>
      </IonTabButton>
      <IonTabButton tab="tab2" href="/tabs/tab2">
        <IonIcon icon={ellipse} />
        <IonLabel>Tab 2</IonLabel>
      </IonTabButton>
      <IonTabButton tab="tab3" href="/tabs/tab3">
        <IonIcon icon={square} />
        <IonLabel>Tab 3</IonLabel>
      </IonTabButton>
    </IonTabBar>
  </IonTabs>
);
```

---

_[View the full topic](https://forum.ionicframework.com/t/routing-with-tab-does-not-work-properly/221848)._
