Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;
 
PREVIOUS NEXT
Tagged: #private #router #react
ADD COMMENT
Topic
Name
5+1 =