1

This link work nicely

import { HashLink as Link } from 'react-router-hash-link';

<Link to={{pathname: '/features', hash: 'some-feature'}}>
    <h2 id="some-feature">Some feature</h2>
</Link>

But when I enter the url into a new browser window:

/features#some-feature

The browser does not scroll to that element.

So scroll to element on link click works perfectly. What logic do I need to add to get scroll to element on page load?

user1283776
  • 19,640
  • 49
  • 136
  • 276
  • Possible duplicate of [Use anchors with react-router](https://stackoverflow.com/questions/40280369/use-anchors-with-react-router) – E McG Oct 26 '18 at 14:16

0 Answers0