'Cannot read Properties of undefined (reading 'location') in react-router-dom
import { useLocation } from 'react-router-dom';
const useQuery = () => new URLSearchParams(useLocation().search);
export const useQueryWithSearch = (search) => new URLSearchParams(search);
export default useQuery;
I have installed react-router-dom @5.2.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
