// adapted from https://stackoverflow.com/a/75920683
// also see https://github.com/remix-run/react-router/blob/496b1fe8253643171ecca6e6a945d98386c4eb00/packages/react-router-dom/index.tsx#L1460C4-L1460C4
// for the unstable_usePrompt implementation in react router itself
// and https://claritydev.net/blog/display-warning-for-unsaved-form-data-on-page-exit for yet another example
functionPrompt(props){
constblock=props.when;
constonPageExit=props.onPageExit;
// NB gives warning in the browser console but thats a bug: https://github.com/remix-run/react-router/issues/10073
// apparently the fix of that bug caused a nr of bugs again too...