From 042f2f3fcb54651fdc0eacfd725a3585beacecd0 Mon Sep 17 00:00:00 2001 From: NikolaBorislavovHristov Date: Thu, 29 Aug 2019 13:10:48 +0300 Subject: [PATCH] event handler function names fixed --- src/common/useLocationHash.js | 6 +++--- src/router/Router/Router.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/useLocationHash.js b/src/common/useLocationHash.js index 343b27e83..3079e57e1 100644 --- a/src/common/useLocationHash.js +++ b/src/common/useLocationHash.js @@ -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; diff --git a/src/router/Router/Router.js b/src/router/Router/Router.js index a2a3a48fa..f020b3b00 100644 --- a/src/router/Router/Router.js +++ b/src/router/Router/Router.js @@ -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 (