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]); };