Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
How to implement deeplinks for react project?

I was trying to implement deep links(not sure if this is the correct term) in my react project what I want to do is this :

  1. the admin gets a mail: "this user can't login: http://localhost:3000/admin/customer-profile/b1d4a11f-4f6c-4dc1-98a9-ac0c30486c16"

  2. the admin is not logged in

  3. the admin clicks the link and is forwarded to the login page

  4. the admin enters his login details

(the new part)

  1. he is forwarded to /admin/customer-profile/b1d4a11f-4f6c-4dc1-98a9-ac0c30486c16

so in the fifth point the admin is redirected to the page link was for instead of going to the homepage.

Below are some snippets to give more info regarding this:

    <div className="App">
      {ready && <Router basename="/admin">

        <Switch>
          <Route path="/login">
            <Login />
          </Route>
          <Route path="/privacypolicy">
            <PrivacyPolicy />
          </Route>
          <Route path="/loginhelp">
            <Help />
          </Route>
          <Route path="/termsconditions">
            <TermsConditions />
          </Route>
          <PrivateRoute path="/logout">
            <Logout />
          </PrivateRoute>

          <Route path="/">
            <SideBar />
            <Switch>
              <PrivateRoute path="/tier-list">
                <TierList />
              </PrivateRoute>
              <PrivateRoute path="/privacy-policy">
                <PrivacyPolicy />
              </PrivateRoute>
              <PrivateRoute path="/help">
                <Help />
              </PrivateRoute>
            </Switch>
          </Route>
        </Switch>
      </Router>}
    </div>

Below is how PrivateRoute looks like :

  function PrivateRoute({ children, ...rest }: any) {
    return (
      <Route
        {...rest}
        render={({ location }) =>
          userInfo != null ? (
            children
          ) : (
            <Redirect
              to={{
                pathname: "/login",
                state: { from: location }
              }}
            />
          )
        }
      />
    )
  }

Any ideas How I shall modify this part to achieve the functionality?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Okay so I solved the problem. What I did was that I passed a pathName prop to the Login component and then if the user was logged in I redirect him to that page but if not then rendered the login page.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda