簡體   English   中英

如何在頁面中使用React Router v1.0.0進行鏈接

[英]how to link in a page with React Router v1.0.0

我想鏈接到一個頁面的特定部分與反應路由器很像錨標簽在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>

目前GitHub上有一個未解決的問題。 它似乎不受支持,但在HistoryLocation此問題時使用HistoryLocation時應該支持它。

編輯

不再受支持

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM