clear-react-router 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/hooks/useIsDataLoading.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -729,6 +729,10 @@ useEffect(() => {
|
|
|
729
729
|
}, [state, process, reset]);
|
|
730
730
|
```
|
|
731
731
|
|
|
732
|
+
### `useIsDataLoading()`
|
|
733
|
+
|
|
734
|
+
Returns a boolean indicating whether any route loader is currently fetching data. Useful for global loading indicators (progress bar, spinner in the layout, etc.).
|
|
735
|
+
|
|
732
736
|
### `useRouterContext()`
|
|
733
737
|
|
|
734
738
|
Returns the router context object and a function to update it. Useful for accessing or modifying global state (like user authentication, theme, etc.) from anywhere in your app.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsDataLoading: () => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { useLoaderState } from './hooks/useLoaderState';
|
|
|
8
8
|
export { useInvalidate } from './hooks/useInvalidate';
|
|
9
9
|
export { useBlocker } from './hooks/useBlocker';
|
|
10
10
|
export { useAction } from './hooks/useAction';
|
|
11
|
+
export { useIsDataLoading } from './hooks/useIsDataLoading';
|
|
11
12
|
export { useRouterContext } from './hooks/useRouterContext';
|
|
12
13
|
export { useSearchParams } from './hooks/useSearchParams';
|
|
13
14
|
export { useFormContext } from './hooks/useFormContext';
|
package/dist/index.js
CHANGED
|
@@ -984,6 +984,13 @@ var useBlocker = (blockerFn) => {
|
|
|
984
984
|
//#region hooks/useAction.ts
|
|
985
985
|
var useAction = router.hooks.useAction;
|
|
986
986
|
//#endregion
|
|
987
|
+
//#region hooks/useIsDataLoading.ts
|
|
988
|
+
var useIsDataLoading = () => {
|
|
989
|
+
const { usePendingState } = router.hooks;
|
|
990
|
+
const [pendingState] = usePendingState();
|
|
991
|
+
return Boolean(pendingState);
|
|
992
|
+
};
|
|
993
|
+
//#endregion
|
|
987
994
|
//#region hooks/useRouterContext.ts
|
|
988
995
|
var useRouterContext = () => {
|
|
989
996
|
const [context, setContext] = router.hooks.useContextState();
|
|
@@ -1061,4 +1068,4 @@ var lazy = (importFn) => ({
|
|
|
1061
1068
|
importFn
|
|
1062
1069
|
});
|
|
1063
1070
|
//#endregion
|
|
1064
|
-
export { Form, Link, Router, createRouter, lazy, useAction, useBlocker, useFormContext, useInvalidate, useLoaderState, useLocation, useNavigate, useParams, useRouterContext, useSearchParams };
|
|
1071
|
+
export { Form, Link, Router, createRouter, lazy, useAction, useBlocker, useFormContext, useInvalidate, useIsDataLoading, useLoaderState, useLocation, useNavigate, useParams, useRouterContext, useSearchParams };
|