A user has just filled 20+ input boxes in your Lightning component and accidentally refreshed the page (that command+R can be tricky), feel the frustration of the user in this case. Well lightning:unsavedChanges is here for our rescue.
Check out below example:
- In this example, the user will have 2 input boxes, if the user inserts any value in these input boxes and reload the page, the browser will show an alert box to confirm the change.
- If the user clicks on the save button, then the browser will not show any alert.