Feature to prevent router redirects
ArtemSBulgakov opened this issue · comments
Artem Bulgakov commented
I use window.onbeforeunload
event to prevent users from losing their form data when they try to close the page. But a user can click on <Link>
, and they will be redirected to another page on the website. And there is no possibility to prevent it.
X. commented
you can create your own link
, then handles the redirect with onClick
event, aleph provides the redirect
function for page navigation as SPA
Artem Bulgakov commented
Ok, will use this method. Thank you!
X. commented
you can get the redirect
method by using useRouter
hooks:
import { useRouter } from "aleph/react"
function App(){
const { url, redirect } = useRouter()
}