Rutas en React-Router-DOM@6 y tome el camino por Uselocation () gancho
function App() {
const location = useLocation();
const [activePlanet, setActivePlanet] = useState('/');
return (
<Routes location={location}>
<Route
path="/"
element={
<DefaultLayout pathName={location.pathname} setActivePlanet={setActivePlanet} activePlanet={activePlanet} />
}>
<Route index element={<Home activePlanet={activePlanet} />} />
{routes.map((route, idx) => (
<Route key={`route-${idx}`} path={route.path} element={route.element} />
))}
</Route>
</Routes>
);
}
danghai