如何在页面中使用React Router v1.0.0进行链接

时间:2015-11-18 18:54:29

标签: javascript jquery reactjs react-router

我想链接到具有反应路由器的页面的特定部分部分,就像锚标记在html中的工作原理一样。但是,我找不到React Router版本1.0.0的解决方案。

目前,我的路由器是这样的:

let history = createHashHistory({
    queryKey: false
});

<Router history={history}>
        <Route path="/" component={a}/>
        <Route path="/b" component={b}/>
        <Route path="/c" component={c}/>
        <Route path="/d" component={d}/>
        <Route path="/e" component={e}/>
        <Route path="/f" component={f}/>
        <Route path="/g" component={g}/>
 </Router>

我试图链接到组件中的特定部分,如

 <Link to="/b#{div_id}"> Go to section with div_id is component {b} </Link>

1 个答案:

答案 0 :(得分:1)

GitHub目前有一个未解决的问题。它似乎不受支持,但在修复此问题时使用HistoryLocation时应该支持它。

修改

这是no longer supported