opendash
Version:
open.DASH data visualization framework
18 lines • 645 B
JavaScript
import * as React from "react";
import { useLocation } from "react-router-dom";
import { useEventListener } from "..";
export function useHref() {
var _a;
var location = useLocation();
var _b = React.useState(window.location.href), href = _b[0], setHref = _b[1];
useEventListener("hashchange", function () {
if (href !== window.location.href) {
setHref(window.location.href);
}
});
React.useEffect(function () {
setHref(window.location.href);
}, [(_a = location) === null || _a === void 0 ? void 0 : _a.key]);
return href;
}
//# sourceMappingURL=useHref.js.map