useRouterQuery.tsx 197 B

123456
  1. import { useLocation } from 'react-router-dom'
  2. export const useRouterQuery = (queryParam: string) => {
  3. const search = new URLSearchParams(useLocation().search)
  4. return search.get(queryParam)
  5. }