diff options
author | Anton Tananaev <anton@traccar.org> | 2022-04-17 15:38:40 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-04-17 15:38:40 -0700 |
commit | ad8484a08ef7eabb41afb33a9774ba8502da1d53 (patch) | |
tree | 957204d055150ee29251b24b28a9ed1d0afe88d0 /modern/src/common/useQuery.js | |
parent | 914f3dae0e34304eebbfaae2b7740e53206ce527 (diff) | |
download | trackermap-web-ad8484a08ef7eabb41afb33a9774ba8502da1d53.tar.gz trackermap-web-ad8484a08ef7eabb41afb33a9774ba8502da1d53.tar.bz2 trackermap-web-ad8484a08ef7eabb41afb33a9774ba8502da1d53.zip |
Handle query parameters
Diffstat (limited to 'modern/src/common/useQuery.js')
-rw-r--r-- | modern/src/common/useQuery.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modern/src/common/useQuery.js b/modern/src/common/useQuery.js index 92398bf8..ed3f74c1 100644 --- a/modern/src/common/useQuery.js +++ b/modern/src/common/useQuery.js @@ -1,3 +1,7 @@ +import { useMemo } from 'react'; import { useLocation } from 'react-router-dom'; -export default () => new URLSearchParams(useLocation().search); +export default () => { + const { search } = useLocation(); + return useMemo(() => new URLSearchParams(search), [search]); +} |