Created
April 14, 2020 19:09
-
-
Save dioscarey/45c4de306c19d1eb77fe5fbc6b196a8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import BeforeUnloadComponent from 'react-beforeunload-component'; | |
import MyModal from 'path/MyModal'; | |
// React Hook | |
const Example = () => { | |
return ( | |
<div> | |
<BeforeUnloadComponent | |
blockRoute={true} | |
modalComponentHandler={({handleModalLeave, handleModalCancel})=>{ | |
return ( | |
<MyModal | |
onClose={handleModalCancel} | |
onSubmit={handleModalLeave} | |
/> | |
) | |
}} | |
/> | |
<form id="myform"> ... </form> | |
<BeforeUnloadComponent/> | |
</div> | |
); | |
} | |
.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment