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

142
Vistas
'Router' from 'react-router-dom' that uses custom history object doesn't change view on Route change [React-Router-Dom v6]

Im trying a simple implement a simple react app that uses 'Router' from react-router-dom that uses custom history object to navigate. But it seems like in the new react version they have made some changes that break the existing react code written in react 17. The code below doesn't change the view or renders a component, but I can see that the URL is changing.

import logo from './logo.svg';
import './App.css';
import './config';
import { Link, Routes, Route, Router } from 'react-router-dom';
import Shellone from './shell-component/shell-one';
import Shelltwo from './shell-component/shell-two';
import history from './history';

const Home = () => {
  return (
  <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <Link to="/"><button>Home</button></Link>
        <Link to="/one"><button>Component One</button></Link>
        <Link to="/two"><button>Component Two</button></Link>
  </header>)
}

function App() {

  return (
    <div className="App">
        <Router navigator={history} location={history.location}>
        <Routes> 
            <Route path="/" element={ <Home /> } />
            <Route path="/one" element={ <Shellone /> } />
            <Route path="/two" element={ < Shelltwo /> } />
        </Routes>
        </Router>
    </div>
  );
}

The above code works with 'BrowserRouter'.

about 4 years ago · Juan Pablo Isaza
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