Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
- KutnerUri
- kylegirard
- landisdesign
- laryro
- latin-1
- lequangdongg
- liuhanqu
Expand Down
3 changes: 3 additions & 0 deletions docs/hooks/use-blocker.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ enum HistoryAction {

The `useBlocker` hook allows you to prevent the user from navigating away from the current location, and present them with a custom UI to allow them to confirm the navigation.

<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>

<docs-info>
This only works for client-side navigations within your React Router application and will not block document requests. To prevent document navigations you will need to add your own <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event" target="_blank">`beforeunload`</a> event handler.
</docs-info>
Expand Down Expand Up @@ -134,3 +136,4 @@ When in a `blocked` state, you may call `blocker.proceed()` to proceed to the bl
When in a `blocked` state, you may call `blocker.reset()` to return the blocker back to an `unblocked` state and leave the user at the current location.

[example]: https://github.com/remix-run/react-router/tree/main/examples/navigation-blocking
[pickingarouter]: ../routers/picking-a-router