Apparently the issue was not in the logic, I have a sideBar from ui.shadcn
, It comes with a <a>
property as default, this was causing the "issue" (not actually an issue, but for me it was), I switched to:
import { useRouter } from 'next/navigation'
const route = useRouter()
const navigate = (url: string) => {
route.push(url)
}
And it's working fine.