Private Router React V6
import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
function App() {
let login = false;
return (
<div className="App">
<BrowserRouter>
{login ? (
<>
<Routes>
<Route path="/" element={<Dashboard />} />
</Routes>
) : (
<Routes>
<Route path="/" element={<Login />} />
</Routes>
)}
</BrowserRouter>
</div>
);
}
export default App;
Zany Zebra