0

following is code for routing any admin route is not working in production build

<Router>
    <React.Suspense fallback={ loading }>
      <Switch>
        <Route exact path="/admin/login" name="Login Page"  component={AdminLogin}/>
        <Route exact path="/login" name="Login Page" render={ props => <FrontLogin { ...props } /> } />
        <Route exact path="/register" name="Register Page" render={ props => <Register { ...props } /> } />
        <Route exact path="/404" name="Page 404" render={ props => <Page404 { ...props } /> } />
        <Route exact path="/500" name="Page 500" render={ props => <Page500 { ...props } /> } />
        {/* <Route path="/admin" name="Admin" render={ props => <Admin { ...props } /> } />
        <Route path="/" name="Home" render={ props => <Front { ...props } /> } /> */}
        <Route exact path="/forgotpassword" name="forgotpassword" component={Forgotpassword} />
        <Route exact path="/resetpassword/:token" name="resetpassword" component={Resetpassword} />
        <Protected  path="/admin" name="Admin" component={Admin} />
        <ProtectedUser exact path="/dashboard" name="Home" component={Front} />
        <ProtectedUser  path="/" name="Home" component={Front} />

      </Switch>
    </React.Suspense>
  </Router>
Harsh
  • 1
  • 1
  • 1
    Does this answer your question? [React router not working after building the app](https://stackoverflow.com/questions/43324649/react-router-not-working-after-building-the-app) – BTSM May 20 '21 at 05:44
  • Try using HashRouter instead of the router – Priyanka Panjabi May 20 '21 at 05:46
  • Hasrouter is working for me but i want remove # from router is it possible ?currenturl:http://localhost:3000/#/login expected url: http://localhost:3000/login – Harsh May 20 '21 at 06:45

0 Answers0