Skip to content
New issue

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

Exclude specific routes #6

Open
hurifajri opened this issue Oct 31, 2024 · 1 comment
Open

Exclude specific routes #6

hurifajri opened this issue Oct 31, 2024 · 1 comment

Comments

@hurifajri
Copy link

I really appreciate and thank you for the library you've created. It's been super helpful!
I wanted to ask, is there an option to exclude specific routes?

@ypresto
Copy link
Collaborator

ypresto commented Nov 19, 2024

If you place useNavigationGuard() in components in app/ or pages/ dir, you just omit it in specific files.

If you place useNavigationGuard() in shared component, you can disable it by enabled option:

const pathname = usePathname()

useNavigationGuard({ enabled: !pathname.match(/\/foo(\/|$)/ })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants