使用查询参数解析 hash history url 时出现问题
作者: sirpy创建于 2023年8月10日更新于 2023年8月10日
如果最初访问 http://localhost/?queryparam=x,则会被重定向到 http://localhost/?queryparam=x#/,然后如果调用 useLocation,则 location 将不包含 queryparam,但如果访问 http://localhost/#/?queryparam=x,则 location 将正确。window.location 在两种情况下都是正确的,但 useLocation 不是。
内容来源: remix-run/history