From 0a77df9d406ec8e59f0034437bada6c36aa76b18 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 5 Sep 2023 22:56:11 +0200 Subject: [PATCH] Fix wrong definition of custom hooks --- src/utils/helpers/hooks.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/helpers/hooks.ts b/src/utils/helpers/hooks.ts index 52807e55..b48d7688 100644 --- a/src/utils/helpers/hooks.ts +++ b/src/utils/helpers/hooks.ts @@ -1,12 +1,13 @@ import { parseQuery } from '@shlinkio/shlink-frontend-kit'; +import { useCallback, useMemo } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; export const useGoBack = () => { const navigate = useNavigate(); - return () => navigate(-1); + return useCallback(() => navigate(-1), [navigate]); }; export const useParsedQuery = (): T => { const { search } = useLocation(); - return parseQuery(search); + return useMemo(() => parseQuery(search), [search]); };