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

213
Vistas
Using react-native-router, redirecting to different pages not working

I have the following:

import React from 'react';
import { View } from "react-native";
import { BrowserRouter as Router, Routes, Route, Link } from "react-router-dom";

import Home from './components/Home';

function App() {
  return (
    <Router>
      <View>
      <Routes>
        <Route path="/">
          <Home/>
        </Route>
      </Routes>
      </View>
    </Router>
  );
}
export default App;

Whenever I go to localhost:3000/ or localhost:3000/home, a blank page appears which means my components are not being rendered when on these pages. I followed both examples on https://v5.reactrouter.com/web/guides/quick-start (web version and native version), however neither seems to work although I think that documentation is slightly outdated because Switch was changed to Routes.

I can't seem to understand what I'm doing wrong here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are using react-router-dom v6, the API changed a bit. Render the routed components on the Route component's element prop as JSX.

<Routes> and <Route>

function App() {
  return (
    <Router>
      <View>
        <Routes>
          <Route path="/" element={<Home/>} />
        </Routes>
      </View>
    </Router>
  );
}
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