Alvin Dimas
Alvin Dimas

Reputation: 101

React-Router Blank Page

I'm still learning to using react-router. I just wondering why my page is blank.

App.js :

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

export default function App() {
return (
  <Router>
    <Routes>
      <Route exact path="/" element={<MainPage/>}/>
    </Routes>
  </Router>
);
}

Upvotes: 0

Views: 81

Answers (2)

user2601376
user2601376

Reputation:

React Router v6 doesn't support exact anymore because all paths are match exactly by default

<Route path="/" element={<MainPage/>}/>

Upvotes: 1

KpStar
KpStar

Reputation: 132

You have to import MainPage from its path.

import MainPage from "layouts/pages/index";

Like this.

Upvotes: 1

Related Questions