Skip to content

Commit

Permalink
feat(routing): export useActiveRouteEvents hook
Browse files Browse the repository at this point in the history
  • Loading branch information
UberMouse committed Oct 11, 2023
1 parent 63f66a2 commit a087638
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export {
matchRoute,
useIsRouteActive,
useRouteArgsIfActive,
useActiveRouteEvents,
TestRoutingContext,
} from "./routing";
export { loggingMetaOptions } from "./useService";
Expand Down
1 change: 1 addition & 0 deletions src/routing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export {
RoutingContext,
TestRoutingContext,
useInRoutingContext,
useActiveRouteEvents,
} from "./providers";
5 changes: 5 additions & 0 deletions src/routing/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export function useInRoutingContext(): boolean {
return context !== undefined;
}

/**
* @public
*
* Returns the list of active routing events, or undefined if there are none / used outside of an xstate-tree routing context
*/
export function useActiveRouteEvents() {
try {
const context = useRoutingContext();
Expand Down

0 comments on commit a087638

Please sign in to comment.