mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: add react-router
This commit is contained in:
13
web/src/hooks/useQuery.ts
Normal file
13
web/src/hooks/useQuery.ts
Normal 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;
|
Reference in New Issue
Block a user