Setup a callback to be fired on the window's beforeunload event. This is useful for saving some data to window.localStorage just before the page refreshes.
beforeunload
window.localStorage
Note: The callback argument should be a function created with React.useCallback().
callback
React.useCallback()
Optional
Setup a callback to be fired on the window's
beforeunloadevent. This is useful for saving some data towindow.localStoragejust before the page refreshes.Note: The
callbackargument should be a function created withReact.useCallback().