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

100
Visualizações
react-router content don't show on screen until refresh

hey I have a react application and I add a navigation bar but I have a problem with the react-router: when the "about" Link gets pressed the URL is changing to /about but the screen is not changing until I refresh the page how can I fix it?

code (navigation.js):

import { Link } from 'react-router-dom';

<Nav fill variant="tabs" defaultActiveKey="/home">
  <Nav.Item>
    <Nav.Link>
      <Link to="/" style={{ textDecoration: 'none' }}>Home</Link>
      </Nav.Link>
  </Nav.Item>
  <Nav.Item>
    <Nav.Link eventKey="link-1">
    <Link to="/about" style={{ textDecoration: 'none' }}>About</Link>
      </Nav.Link>
  </Nav.Item>
  <Nav.Item>
    <Nav.Link eventKey="link-2">
    <Link to="/contact" style={{ textDecoration: 'none' }}>Contact</Link>
      </Nav.Link>
  </Nav.Item>
  <Nav.Item>
    <Nav.Link eventKey="disabled" disabled>
    School
    <br />
     Chat
    </Nav.Link>
  </Nav.Item>
</Nav>

code (app.js):

import { BrowserRouter as Router, Route, Switch } from "react-router-dom";

        <Router>
         <div className="App">
            <Navigation />
                <Switch>
                    <Route exact path="/">
                        <HomeScreen />
                    </Route>
                    <Route path="/about">
                        <About />
                    </Route>
                    <Route path="/contact">
                        <Contact />
                    </Route>
                </Switch>
         </div>
         </Router>
about 4 years ago · Juan Pablo Isaza
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