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