1

I am working on an event booking app, the home page path is events page, i make these routes to manage redirect authenticated user requests login or signup pages into events,

{token && <Route path="/login" element={<Navigate replace to="/events" />} exact />}
<Route path='/login' element={<LoginPage />} />
{token && <Route path="/signup" element={<Navigate replace to="/events" />} exact />}
<Route path='/signup' element={<SignUpPage />} exact />
            

it works will but i need to reduce the code look, can i make only one route for both first and third routes!! for example:

{token && <Route path="/login || /signup" element={<Navigate replace to="/events" />} exact />}
entesar
  • 929
  • 1
  • 8
  • 12
  • Does this answer your question? [Multiple path names for a same component in React Router](https://stackoverflow.com/questions/40541994/multiple-path-names-for-a-same-component-in-react-router) – Hunter McMillen Feb 22 '22 at 03:56

0 Answers0