Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using React-Router to link within a page

I'm trying to make an anchor tag which will link to a location within the same page (like this)

However React-Router hijacks that, and and routes me to nothing, as I haven't established that link in the hierarchy. So it sends me to the root location of that name, instead of a location on the same page.

like image 346
ChadF Avatar asked May 29 '26 04:05

ChadF


1 Answers

if i understand your question, you can use hashlocation instead of history location. like this

ReactRouter.run(routes, hashlocation, (Handler) => {
  React.render(<Handler/>);
});
like image 145
Rei Dien Avatar answered May 31 '26 16:05

Rei Dien