chore: add react-router

This commit is contained in:
Steven
2022-09-16 22:48:41 +08:00
parent 8d694f7732
commit 660908e436
5 changed files with 54 additions and 7 deletions

13
web/src/hooks/useQuery.ts Normal file
View File

@ -0,0 +1,13 @@
// A custom hook that builds on useLocation to parse
import React from "react";
import { useLocation } from "react-router-dom";
// the query string for you.
const useQuery = () => {
const { search } = useLocation();
return React.useMemo(() => new URLSearchParams(search), [search]);
};
export default useQuery;