Last active
August 9, 2022 07:34
-
-
Save munierujp/fd64d9304ffa95353fc48412a43f7a89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useMemo } from 'react' | |
import { useLocation } from 'react-router-dom' | |
/** | |
* @see https://v5.reactrouter.com/web/example/query-parameters | |
*/ | |
export const useQueryParams = (): URLSearchParams => { | |
const { search } = useLocation() | |
return useMemo(() => new URLSearchParams(search), [search]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment