Cara menavigasi secara program dalam komponen kelas 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