Skip to content

Commit f552e92

Browse files
authored
docs(hooks/use-blocker): add warning about data routers (#13246)
* docs: add warning about data routers to `useBlocker` * chore: add `laryro` to the contributors
1 parent 6d7a4da commit f552e92

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
- KutnerUri
156156
- kylegirard
157157
- landisdesign
158+
- laryro
158159
- latin-1
159160
- lequangdongg
160161
- liuhanqu

docs/hooks/use-blocker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ enum HistoryAction {
6060

6161
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.
6262

63+
<docs-warning>This feature only works if using a data router, see [Picking a Router][pickingarouter]</docs-warning>
64+
6365
<docs-info>
6466
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.
6567
</docs-info>
@@ -134,3 +136,4 @@ When in a `blocked` state, you may call `blocker.proceed()` to proceed to the bl
134136
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.
135137

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

0 commit comments

Comments
 (0)