The getUserConfirmation prop accepts a function as its value, and it's executed when the user-initiated navigation is blocked using the <Prompt> component. The <Prompt> component shows a confirmation dialog box using the window.confirm method, and navigates the user to the selected path only if the user clicks the OK button. However, when the <BrowserRouter> component specifies the getUserConfirmation prop, the function provided as a value to this prop will be executed. This provides an opportunity to display a custom dialog box.
Let's take a look at the following configuration:
<BrowserRouter getUserConfirmation={this.userConfirmationFunc}> <div className="container"> <nav> <Link to="/dashboard">Dashboard</Link