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

Add usePrompt hook #13

Open
PatrickDeVries opened this issue Dec 23, 2022 · 1 comment
Open

Add usePrompt hook #13

PatrickDeVries opened this issue Dec 23, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@PatrickDeVries
Copy link
Member

  • Prompt a user with a message when they attempt to navigate to a new page unless a condition is met
  • If the user accepts, navigate to the original destination
  • If user rejects, stay on the current page
  • Should be functional for all routing methods using window event listeners
@dawsonbooth
Copy link
Member

dawsonbooth commented Dec 23, 2022

This would be a nice add for sure, though I think a one-size-fits-all solution might be hard to put together.

A window confirm should work universally for routing frameworks that rely solely on the window location and history. Unfortunately, there are SSR specificities to consider, and SPAs by nature avoid conventional routing.

These links should provide a decent starting point. Will update as I find more!

@dawsonbooth dawsonbooth added enhancement New feature or request help wanted Extra attention is needed labels Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants