We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I've faced with not working canDeactivate by default. I've fixed it by the following code sample:
canDeactivate
const router = createRouter([ { name: 'messages', path: '/messages' }, { name: 'messages.create', path: '/create' }, ], { autoCleanUp: false, }); router.usePlugin(browserPlugin({ useHash: true, forceDeactivate: false, })); const canDeactivate = (router) => { return (toState, fromState) => { // Some conditions return false; } } router.canDeactivate('messages.create', canDeactivate); router.start();
There are some related issue:
Question: what are the use cases of canDeactivate without forceDeactivate: false and autoCleanUp: false options?
forceDeactivate: false
autoCleanUp: false
The text was updated successfully, but these errors were encountered:
Another related question: is it correct way to connect View with canDeactivate handler?
// autoCleanUp: true // route 'messages.create' const BlockedView = () => { const { router } = useRouteNode('messages.create'); const [blocked, setBlocked] = useState(false); router.canDeactivate('messages.create', (router) => (toState, fromState) => { return !blocked; }); return ( <View> <Link onClick={() => setState(!blocked)}>Toogle {blocked ? 'true' : 'false'}</Link> </View> ); }
Sorry, something went wrong.
No branches or pull requests
Hi, I've faced with not working
canDeactivate
by default. I've fixed it by the following code sample:There are some related issue:
Question: what are the use cases of
canDeactivate
withoutforceDeactivate: false
andautoCleanUp: false
options?The text was updated successfully, but these errors were encountered: