パス全体ではなく、「/checkout」と「/」の間だけ表示したい。React reuter dom v6 で行うのは困難です。
import React from "react";
import "./App.css";
import Header from "./Header";
import Home from "./Home";
import Checkout from "./Checkout";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Login from "./Login";
function App() {
return (
// BEM
<BrowserRouter>
<div className="app">
<Header />
<Routes>
<Route path="/" element={<Home />}></Route>
<Route path="/checkout" element={<Checkout />}></Route>
<Route path="/login" element={<Login />}></Route>
</Routes>
</div>
</BrowserRouter>
);
}
export default App;