0

Here is my code

<Route path='/' component ={component}>
 <Route path='/login' component = {login}/>
 <Route path='/signup' component = {signUp}/>
</Route>
<Route exact path = '/newPath' component = {NewComponent} />

Problem is if I am calling login and signup I want to call '/' also. but when I want to call '/newPath' i don't want to use '/'. but how to avoid '/' without using the exact keyword. because when I use the exact word with '/' it can not be called in login and signup.

Omid Nikrah
  • 2,178
  • 2
  • 11
  • 25
amitchauh4n
  • 972
  • 2
  • 11
  • 16

1 Answers1

3

You can:

<BrowserRouter>
  <Switch>
      <Route path="/auth" component={Auth} />
      <Route path="/" component={Dashboard} />
      ...
    </Switch>
</BrowserRouter>

And inside your Auth: have another router with login and signup components

igorves
  • 531
  • 3
  • 10