import qs, { ParsedQuery } from 'query-string'
import { useLocation } from 'react-router-dom'

export function useQueryParameters<T extends ParsedQuery>() {
  const { search } = useLocation()
  return qs.parse(search) as T
}
