mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Fix wrong definition of custom hooks
This commit is contained in:
parent
cd167f4078
commit
0a77df9d40
1 changed files with 3 additions and 2 deletions
|
@ -1,12 +1,13 @@
|
||||||
import { parseQuery } from '@shlinkio/shlink-frontend-kit';
|
import { parseQuery } from '@shlinkio/shlink-frontend-kit';
|
||||||
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
export const useGoBack = () => {
|
export const useGoBack = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
return () => navigate(-1);
|
return useCallback(() => navigate(-1), [navigate]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useParsedQuery = <T>(): T => {
|
export const useParsedQuery = <T>(): T => {
|
||||||
const { search } = useLocation();
|
const { search } = useLocation();
|
||||||
return parseQuery<T>(search);
|
return useMemo(() => parseQuery<T>(search), [search]);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue