Feature to prevent router redirects
ArtemSBulgakov opened this issue · 3 comments
ArtemSBulgakov 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.
ije commented
you can create your own link
, then handles the redirect with onClick
event, aleph provides the redirect
function for page navigation as SPA
ArtemSBulgakov commented
Ok, will use this method. Thank you!
ije commented
you can get the redirect
method by using useRouter
hooks:
import { useRouter } from "aleph/react"
function App(){
const { url, redirect } = useRouter()
}