Skip to content

Commit 446cbbe

Browse files
committed
docs: fix use-page-key comments
1 parent 3db03a0 commit 446cbbe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

www/shared/react/next-router/use-page-key.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ const usePageKey = (depth = null) => {
1010
const { asPath } = useRouter();
1111

1212
const pageKey = useMemo(() => {
13+
// Remove query string.
1314
let pageKey = asPath.replace(/\?.+/, '');
1415

16+
// Handle depth.
1517
if (depth != null) {
1618
pageKey = pageKey.split('/').slice(0, depth + 1).join('/');
1719
}
1820

1921
return pageKey;
20-
}, [asPath, depth]); // Remove query string
22+
}, [asPath, depth]);
2123

2224
return pageKey;
2325
};

0 commit comments

Comments
 (0)