Reactjs 使用哈希(数字符号)符号反应路由器v4处理路径

Reactjs 使用哈希(数字符号)符号反应路由器v4处理路径,reactjs,hash,navigation,react-router-v4,react-router-dom,Reactjs,Hash,Navigation,React Router V4,React Router Dom,我正在尝试在react应用程序中使用Twitch登录。Twitch正在返回重定向uri为“”的数据,但我无法处理它。React路由器正在导航到NotFound 注意: 如果我导航到“”而没有“#”,它将导航到主页 我的App.js: <Provider store={store}> <BrowserRouter> <div> <div className="bg"></div> <

我正在尝试在react应用程序中使用Twitch登录。Twitch正在返回重定向uri为“”的数据,但我无法处理它。React路由器正在导航到NotFound

注意: 如果我导航到“”而没有“#”,它将导航到主页

我的App.js:

<Provider store={store}>
    <BrowserRouter>
      <div>
        <div className="bg"></div>
        <MasterPage></MasterPage>
        <div className="BrowserRouter">
          <Switch>
            <Route exact path='/' component={MainPage} />
            <Route path='/home/:id?' component={MainPage} />
            <Route path='/profile' component={Profile} />
            <Route path='/stream' component={Stream} />
            <Route path='/store' component={Market} />
            <Route component={NotFound} />{/*no match*/}
          </Switch>
        </div>
      </div>
    </BrowserRouter>
  </Provider>

{/*不匹配*/}

我如何处理它?

您可以在未找到的路线上处理它。首先检查散列。使用匹配参数。如果识别-accesstoken。渲染或重定向,否则使用NotFound谢谢,它可以解决我的问题,但它似乎是错误的解决方法。