I am having a page where I edit the values. If a user wants to exit from the page without saving the details, in that case, I will show a prompt. I implemented this with NavigationPrompt. It is working fine for other page navigation and also it shows a dialog for the current page also(I had a link, by clicking on that one it directs to the current page). I don't want dialog for the same page navigation. Can anyone help me with this?
<NavigationPrompt when={this.state.simulationView}>
{({ onConfirm, onCancel }) => (
<Dialog
when
onClose={() => { this.setState({ toggleConfirmationDialogue: false }); }}
aria-labelledby="customized-dialog-title"
open={this.state.simulationView}
>
<ExitSimulationDialog
title={'Exit Simulation'}
onClickConfirm={() => { onConfirm(); this.setState({ simulationView: false }); }}
dialogClose={onCancel}
/>
</Dialog>
)}
</NavigationPrompt>