React - 如何从查询字符串中获取参数值? - React - How to get parameter value from query string?

问题:

How can I define a route in my routes.jsx file to capture the __firebase_request_key parameter value from a URL generated by Twitter's single sign on process after the redirect from their servers?如何在我的 routes.jsx 文件中定义路由以从 Twitter 的单点登录过程生成的 URL 中捕获__firebase_request_key参数值?

http://localhost:8000/#/signin?_k=v9ifuf&__firebase_request_key=blablabla

I tried with the following routes configuration, but the :redirectParam is not catching the mentioned param:我尝试使用以下路由配置,但:redirectParam没有捕获提到的参数:

<Router>
  <Route path="/" component={Main}>
    <Route path="signin" component={SignIn}>
      <Route path=":redirectParam" component={TwitterSsoButton} />
    </Route>
  </Route>
</Router>

解决方案:

参考一: https://stackoom.com/question/2OKpq
参考二: React - How to get parameter value from query string?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章