• 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.

    Note: The callback argument should be a function created with React.useCallback().

    Parameters

    • callback: ((event) => any)
        • (event): any
        • Parameters

          • event: BeforeUnloadEvent

          Returns any

    • Optional options: {
          capture?: boolean;
      }
      • Optional capture?: boolean

    Returns void