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

Implement option to cancel route change in yrv #88

Open
Immo-Be opened this issue Aug 19, 2022 · 2 comments
Open

Implement option to cancel route change in yrv #88

Immo-Be opened this issue Aug 19, 2022 · 2 comments

Comments

@Immo-Be
Copy link

Immo-Be commented Aug 19, 2022

Hey! :)

With react-router there is the prompt component that prevents a user to navigate to another page (e.g. when there are unsaved changes in a form). It would be nice to implement a functionality like that.

@pateketrueke
Copy link
Owner

Hi, it sounds like a nice feature, if it were already implemented how its DSL would look?

@Immo-Be
Copy link
Author

Immo-Be commented Aug 23, 2022

I'd say a good implementation would be react-router where the user is prompted with a message when a certain state is entered. The prompt component is then rendered like:

<Prompt when={formIsHalfFilledOut} message="Are you sure you want to leave?" />

Ideally, message would accept not only a string but also a function

See here for more details

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