This is a combination of a bug report and question, I've run into a problem when using Link with a hash value.
Like this
<Link to="#foo">Foo</Link>
then I'd expect element with a foo id to enter the viewport (like a native link behaves) but right now nothing happens except that the url updates.
I'm guessing that the preventDefault is causing the issue here https://github.com/reach/router/blob/317a679c1975e32b4096880a140defc9489064ac/src/index.js#L390-L393
Is this an intended behavior or a bug? I'd be happy to provide a PR fixing this.
Why do you need Linkwith anchor? You can just use <a> in this case.
I think there are use cases for when you'd want that. Like the reactjs.org website on the /tutorial page. In the sidebar you want to be able to check which links are active etc.
Gatsby has implemented custom behavior to solve this but it would be nice have this in core
You can just use
<a>in this case
In won't trigger location change
Most helpful comment
I think there are use cases for when you'd want that. Like the reactjs.org website on the
/tutorialpage. In the sidebar you want to be able to check which links are active etc.Gatsby has implemented custom behavior to solve this but it would be nice have this in core