React - How to get parameter value from query string?

后端 未结 30 2140
温柔的废话
温柔的废话 2020-11-22 10:22

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 a

30条回答
  •  一向
    一向 (楼主)
    2020-11-22 11:05

    Or perhaps something like this?

    let win = {
      'location': {
        'path': 'http://localhost:8000/#/signin?_k=v9ifuf&__firebase_request_key=blablabla'
      }
    }
    if (win.location.path.match('__firebase_request_key').length) {
      let key = win.location.path.split('__firebase_request_key=')[1]
      console.log(key)
    }

提交回复
热议问题