Skip to main content

useBeforeUnload

还没翻译译自英文(reactrouter.com)本页 15 段都还没译

useBeforeUnload

Framework Data Declarative

Summary

Reference Documentation ↗

Set up a callback to be fired on Window's beforeunload event.

Signature

function useBeforeUnload(
  callback: (event: BeforeUnloadEvent) => any,
  options?: {
    capture?: boolean;
  },
): void

Params

callback

The callback to be called when the beforeunload event is fired.

options.capture

If true, the event will be captured during the capture phase. Defaults to false.

Returns

No return value.

Traducción © 2026 fanyi.dev · Original © 2026 React Training LLC, Remix Software Inc., Shopify Inc. (MIT)