From 702f2dbc12065f797b027abbf97b340337afe3c2 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Fri, 1 Oct 2021 18:25:51 -0700 Subject: [PATCH] Add react router url query hook --- src/hooks/useRouterQuery.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/hooks/useRouterQuery.ts diff --git a/src/hooks/useRouterQuery.ts b/src/hooks/useRouterQuery.ts new file mode 100644 index 0000000..5b3dc5d --- /dev/null +++ b/src/hooks/useRouterQuery.ts @@ -0,0 +1,7 @@ +import { useLocation } from 'react-router-dom'; + +const useRouterQuery = () => { + return new URLSearchParams(useLocation().search); +}; + +export default useRouterQuery;