我有以下URL:
http://my.site/?code=74e30ef2-109c-4b75-b8d6-89bdce1aa860
我希望您能将我重定向到以下内容:
http://my.site#/homepage
我用以下方式实现:
import { push } from 'react-router-redux'
...
dispatch(push('/homepage'))
但是React把我带到了:
http://my.site/?code=74e30ef2-109c-4b75-b8d6-89bdce1aa860#/homepage
我该如何让React在不重新加载应用程序的情况下,从浏览器地址栏中删除查询参数?请注意,保留HTML标记。
push(...)
是什么? - Titusthis.props.history.push(...)
的方式。 - Tituspathname:'/', search: '', hash:'#/hompage' })
- Neel Patelhistory.push(/homepage)
吗?其中的 history 是来自路由属性 https://reacttraining.com/react-router/web/api/Route/route-props - Olivier Boissé