From ad8484a08ef7eabb41afb33a9774ba8502da1d53 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 17 Apr 2022 15:38:40 -0700 Subject: Handle query parameters --- modern/src/common/useQuery.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modern/src/common') 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]); +} -- cgit v1.2.3