Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
react-router: la ubicación "/" no coincidió con ninguna ruta

este es mi codigo

 import React from 'react'; import { Router, Route, IndexRoute, hashHistory } from 'react-router'; import Home from './components/Home'; import ArtistMain from './components/artists/ArtistMain'; const componentRoutes = { component: Home, path: "/", indexRoute: { component: ArtistMain }, childRoutes: [ { path: "artists/new", getComponent(location, cb) { System.import('./components/artists/ArtistCreate') .then(module => cb(null, module.default)); } }, { path: "artists/:id", getComponent(location, cb) { System.import('./components/artists/ArtistDetail') .then(module => cb(null, module.default)); } }, { path: "artists/:id/edit", getComponent(location, cb) { System.import('./components/artists/ArtistEdit') .then(module => cb(null, module.default)); } } ] }; const Routes = () => { return ( <Router history={hashHistory} router={componentRoutes} /> ); }; export default Routes;

Al ejecutar en el navegador, obtuve una página en blanco y el siguiente ejemplo en la consola de JavaScript:

 Warning: [react-router] Location "/" did not match any routes

Estas son mis dependencias:

 "dependencies": { "faker": "^3.1.0", "lodash": "^4.17.2", "react": "^15.4.1", "react-dom": "^15.4.1", "react-input-range": "^0.9.2", "react-redux": "^4.4.6", "react-router": "^3.0.0", "redux": "^3.6.0", "redux-form": "^6.3.2", "redux-thunk": "^2.1.0" },

Por qué no es una pregunta duplicada: porque otra pregunta SO se resolvió migrando a react-router v3, y ya estoy en esta versión, o importando IndexRoute en lugar de indexroute o similar, pero no tengo este error tipográfico en mi código; Además, no tengo problema en reemplazar hashHistory browserhistory ya lo estoy usando; Además, el 99% de la pregunta SO sobre este tema usa sintaxis declarativa, mientras que estoy usando js.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Bastante seguro de que esto se debe a que el atributo del router debe ser routes :

 const Routes = () => { return ( <Router history={hashHistory} routes={componentRoutes} /> ); };
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!