Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

In React v6, how to check form is dirty before leaving page/route

$
0
0

I want a prompt to appear at the moment of wanting to leave the page without having canceled or without having sent the changes

As of v6.0.0-beta - useBlocker and usePrompt were removed I want to know another way to do it.

This doesn't work anymore:

<Promptwhen={formik.dirty}message="You have unsaved changes. Are you sure you want to leave?"/>

Nor this:

useBlocker(() => "Hello from useBlocker -- are you sure you want to leave?",isBlocking);

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>