I am trying to make a login flow using react. Routes are working as expected. But when I try to introduce nav bar, it is visible on all routes. I want to show nav bar only on selected components (only on profile and home route).
Any suggestions would be appreciated.
This is the Routes.js:
export default class Routes extends Component {
render() {
return (
<Switch>
<Route
exact
path='/*/home'
component={Home}
/>
<Route
exact
path='/*/login'
component={Login}
/>
<Route
exact
path='/*/profile'
component={Profile}
/>
<Route
exact
path='/'
component={Main}
/>
<Route
exact
path='/*/'
component={Org}
/>
</Switch>
);
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
This is the App.js:
<div className="App">
<Nav />
<Routes />
</div>