4

I want to link to a specific section section of a page with react router a lot like how anchor tags would work in html. However, I couldn't find solutions with React Router version 1.0.0.

Currently, i have my router like this:

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>

and I am trying to link to a specific section in the components like

 <Link to="/b#{div_id}"> Go to section with div_id is component {b} </Link>
Limon Monte
  • 52,539
  • 45
  • 182
  • 213

1 Answers1

1

There is currently an open issue on GitHub for this. It doesn't appear to be supported, but it should be supported when using HistoryLocation when this issue is fixed.

EDIT

This is no longer supported.

Kyeotic
  • 19,697
  • 10
  • 71
  • 128