0👍
I suggest to use another approach:
- store all inputs in a component itself
- track changes in a components itself and set some boolean flag
isChanged
- When a user navigates away:
if (this.isChanged) {
// alert user
} else {
// store all inputs to a state
// allow user to proceed
}
Source:stackexchange.com