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?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章