@atlaskit/page-layout
Version:
A collection of components which let you compose an application's page layout.
19 lines • 462 B
JavaScript
import { useEffect } from 'react';
import { useSkipLinks } from './use-skip-links';
export const useSkipLink = (id, skipLinkTitle) => {
const {
registerSkipLink,
unregisterSkipLink
} = useSkipLinks();
useEffect(() => {
if (id && skipLinkTitle) {
registerSkipLink({
id,
skipLinkTitle
});
}
return () => {
unregisterSkipLink(id);
};
}, [id, skipLinkTitle, registerSkipLink, unregisterSkipLink]);
};