So navigieren Sie programmatisch in der Klassenkomponente React Router V6

<Navigate to="/dashboard" replace={true} /> (Write this in your dom anywhere) example below;

import { Navigate } from "react-router-dom";

<div>
     {isUserLoggedIn ? (
        <Navigate to="/login" replace={true} />
      ) : null}
</div>
Timur Turbil