score:2

Accepted answer
function App() {
  return (
    <Router>
      <div className="App">
        <Routes>
          <Route
            element={(
              <>
                <NavBar />
                <Outlet />
              </>
            )}
          >
            <Route path="/componenta" element={<ComponentA />} />
            <Route path="/componentb" element={<ComponentB />} />
          </Route>
          ... other routes without navbar
        </Routes>
      </div>
    </Router>
  );
}

score:2

<NavBar />
<Routes>
   <Route exact path="/componenta" element={<ComponentA />} />
   <Route exact path="/componentb" element={<ComponentB />} />
</Routes>

Related Query

More Query from same tag