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

160
Vistas
How to open a child route from a parent route by default - react-router-v6

I have tried to look through some docs for this one but can't seem to find what I'm looking for. I have some routes below.

I want to do the following: I want to be able to click on to the dotfile route but have the aliase route open as default.

The app is similar to this:

link - link -> page
link - link -> page
link - link

If that helps....I want the first page to be open when the 2nd link is clicked in the 2nd row. I am not sure if I am explaining it correctly.

My current routes are below these work as intended, I am just struggling to figure out how to open a child route initially

 <Routes>
      <Route path="/" element={<App />} />
      <Route path="dotfiles" element={<Dotfiles />}>
        <Route path="aliases" element={<Aliases />} /> // open when dotfiles is clicked
        <Route path="variables" element={<Variables />} />
        ...
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I believe you should be able to use history.push(url).

Sol 1: This is a react package you should be able to use to navigate between web pages. I would do it in the componentDidMount of Dotfiles.js. This would make it so that you navigate to aliases.js when you load into dotfiles.js.

Use this to install history: npm i history https://www.npmjs.com/package/history

Sol 2: (I am not sure if this will work for sure in your case) you can import Aliases in to dotfiles and render Aliases in dotfiles. This is the better solution in my opinion but I'm not sure if it applies in your case.

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