Skip to content

Commit

Permalink
add normalizeUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
codehz committed Feb 2, 2024
1 parent 7c57728 commit f35cc69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,17 @@ export function useRouteState<T extends {}>(key: string, initial: T) {

export const RouterHost = ({
children,
normalizeUrl = (url: string) => url,
Shell,
onRouteUpdated,
}: {
children: React.ReactElement;
normalizeUrl?: (url: string) => string;
Shell: React.ComponentType<{ children: React.ReactElement; route?: string }>;
onRouteUpdated?: (path: string) => void;
}) => {
const pathname = useLocationProperty(
() => location.pathname + location.search,
() => normalizeUrl(location.pathname + location.search),
() => globalX.__INITIAL_ROUTE__
);
const [current, setCurrent] = useState(children);
Expand Down

0 comments on commit f35cc69

Please sign in to comment.