Skip to content

Instantly share code, notes, and snippets.

@robertgonzales
robertgonzales / App.jsx
Last active March 26, 2020 15:57
How to make a custom Prompt (using getUserConfirmation) for React Router v4
// use Prompt like normal... magic happens in getUserConfirmation
class App extends Component {
render () {
return (
<Router getUserConfirmation={getUserConfirmation}>
{...}
<Prompt
when={formIsHalfFilledOut}
message="Are you sure you want to leave?"
/>