Perhaps I'm missing something, but is there a way to register a callback for route changes... And cancel them? Like an onbeforeunload but for routes?
function TestScreen(props) {
const route = useRoute()
route.beforeTransition(e => { // maybe 'e' contains target route info?
// (user code to check for form changes...)
return false // false to prevent transition?
})
return (
<form> . . . </form>
)
}
I don't know about the api specifically, that's just as an example of potential usage.
Perhaps I'm missing something, but is there a way to register a callback for route changes... And cancel them? Like an
onbeforeunloadbut for routes?I don't know about the api specifically, that's just as an example of potential usage.