首页 > 解决方案 > 反应路由问题重定向

问题描述

如何使用 onload 获取哈希位置

            <Redirect exact from="/:id" to="/user/1231231"/>
            <Route path="/user/:id" exact component={UserComponent}/>

标签: reactjsreact-nativereact-router

解决方案


我不知道您使用的是什么版本的软件包。但这里是基本的例子。试着去?profile=:id

https://codesandbox.io/s/react-router-stackoverflow-lchu9

gif


推荐阅读