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

211
Views
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 answers
Answer question

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 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!