You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`useBeforeLeave` takes a function that will be called prior to leaving a route. The function will be called with:
899
900
900
901
- from (_Location_): current location (before change).
901
-
- to (_string | number_}: path passed to `navigate`.
902
-
- options (_NavigateOptions_}: options passed to `navigate`.
903
-
- preventDefault (_void function_): call to block the route change.
904
-
- defaultPrevented (_readonly boolean_): true if any previously called leave handlers called preventDefault().
905
-
- retry (_void function_, _force?: boolean_ ): call to retry the same navigation, perhaps after confirming with the user. Pass `true` to skip running the leave handlers again (ie force navigate without confirming).
902
+
- to (_string | number_): path passed to `navigate`.
903
+
- options (_NavigateOptions_): options passed to `navigate`.
904
+
- preventDefault (_function_): call to block the route change.
905
+
- defaultPrevented (_readonly boolean_): `true` if any previously called leave handlers called `preventDefault`.
906
+
- retry (_function_, _force?: boolean_ ): call to retry the same navigation, perhaps after confirming with the user. Pass `true` to skip running the leave handlers again (i.e. force navigate without confirming).
* `useMatch` takes an accessor that returns the path and creates a `Memo` that returns match information if the current path matches the provided path.
148
+
* Useful for determining if a given path matches the current route.
* Retrieves a tuple containing a reactive object to read the current location's query parameters and a method to update them.
198
+
* The object is a proxy so you must access properties to subscribe to reactive updates.
199
+
* **Note** that values will be strings and property names will retain their casing.
200
+
*
201
+
* The setter method accepts an object whose entries will be merged into the current query string.
202
+
* Values `''`, `undefined` and `null` will remove the key from the resulting query string.
203
+
* Updates will behave just like a navigation and the setter accepts the same optional second parameter as `navigate` and auto-scrolling is disabled by default.
* useBeforeLeave takes a function that will be called prior to leaving a route.
242
+
* The function will be called with:
243
+
*
244
+
* - from (*Location*): current location (before change).
245
+
* - to (*string | number*): path passed to `navigate`.
246
+
* - options (*NavigateOptions*): options passed to navigate.
247
+
* - preventDefault (*function*): call to block the route change.
248
+
* - defaultPrevented (*readonly boolean*): `true` if any previously called leave handlers called `preventDefault`.
249
+
* - retry (*function*, force?: boolean ): call to retry the same navigation, perhaps after confirming with the user. Pass `true` to skip running the leave handlers again (i.e. force navigate without confirming).
250
+
*
251
+
* @example
252
+
* ```js
253
+
* useBeforeLeave((e: BeforeLeaveEventArgs) => {
254
+
* if (form.isDirty && !e.defaultPrevented) {
255
+
* // preventDefault to block immediately and prompt user async
256
+
* e.preventDefault();
257
+
* setTimeout(() => {
258
+
* if (window.confirm("Discard unsaved changes - are you sure?")) {
259
+
* // user wants to proceed anyway so retry with force=true
0 commit comments