on react router if you initially go to http://localhost/?queryparam=x then you will be redirect to http://localhost/?queryparam=x#/ then if you call useLocation the location will not have the queryparam but if you go to http://localhost/#/?queryparam=x then location will be correct. window.location is correct in both cases, but useLocation isn't