diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-21 13:10:32 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-21 13:11:55 +0300 |
commit | a7e97f33ae31dd2be1d7c04ecb8f2439ffebf921 (patch) | |
tree | ac325cc0f1b6eef9243bb0c1c2a247ad60fff5bf /src/hooks/useQuery.ts | |
parent | 84623c73b826d22d9b7b3103796bc754e7433b96 (diff) | |
download | commercel-ui-a7e97f33ae31dd2be1d7c04ecb8f2439ffebf921.tar.gz |
feat: add useQuery hook
Diffstat (limited to 'src/hooks/useQuery.ts')
-rw-r--r-- | src/hooks/useQuery.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/hooks/useQuery.ts b/src/hooks/useQuery.ts new file mode 100644 index 0000000..b2cb628 --- /dev/null +++ b/src/hooks/useQuery.ts @@ -0,0 +1,9 @@ +import { useLocation } from 'react-router-dom'; + +const useQuery = () => { + const location = useLocation(); + const searchParams = new URLSearchParams(location.search); + return Object.fromEntries(searchParams); +}; + +export default useQuery; |