event handler function names fixed

This commit is contained in:
NikolaBorislavovHristov 2019-08-29 13:10:48 +03:00
parent e6eb49fe7f
commit 042f2f3fcb
2 changed files with 7 additions and 7 deletions

View file

@ -3,12 +3,12 @@ const React = require('react');
const useLocationHash = () => {
const [locationHash, setLocationHash] = React.useState(window.location.hash);
React.useEffect(() => {
const onLocationHashChanged = () => {
const onLocationHashChange = () => {
setLocationHash(window.location.hash);
};
window.addEventListener('hashchange', onLocationHashChanged);
window.addEventListener('hashchange', onLocationHashChange);
return () => {
window.removeEventListener('hashchange', onLocationHashChanged);
window.removeEventListener('hashchange', onLocationHashChange);
};
}, []);
return locationHash;

View file

@ -29,7 +29,7 @@ const Router = ({ onPathNotMatch, ...props }) => {
}
}, []);
React.useEffect(() => {
const onLocationHashChanged = () => {
const onLocationHashChange = () => {
const { pathname, query } = UrlUtils.parse(window.location.hash.slice(1));
const routeConfig = routeConfigForPath(viewsConfig, pathname);
if (!routeConfig) {
@ -72,10 +72,10 @@ const Router = ({ onPathNotMatch, ...props }) => {
});
});
};
window.addEventListener('hashchange', onLocationHashChanged);
onLocationHashChanged();
window.addEventListener('hashchange', onLocationHashChange);
onLocationHashChange();
return () => {
window.removeEventListener('hashchange', onLocationHashChanged);
window.removeEventListener('hashchange', onLocationHashChange);
};
}, [onPathNotMatch]);
return (