Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda