Renderhook uselocation. Instead look into the useNavigate() API.