mauricevancooten / react-anchor-link-smooth-scroll

React component for anchor links using the smooth scroll polyfill.
243 stars 31 forks source link

How do I go to another page and an anchor within that other page within the same SPA using HashLink? page#subsection is not working, but it works perfectly with regular Link from react-router-dom #21

Closed juanlet closed 5 years ago

juanlet commented 5 years ago

Hey, I have section A and section B. Section A has all AnchorLink components to smoothly scroll to each section and that works fine, except for one of the links that goes to section B which is in another page. When I go to section B I still have the same navbar with the all the AnchorLinks that refers to subsections of section A. But if I use href="page#subsection" doesn't work when using AnchorLink component. This works fine with regular Link component from react-router but I wanted to know if it was possible to do it with AnchorLink component and if possible keeping the smooth scroll behaviour when going to another section#subsection . Otherwise I guess I'll have to render the navbar with either Link or AnchorLink depending on in which route I'm in with the help of this.props.location.pathname.

mauricevancooten commented 5 years ago

I'm not sure, I haven't tried to do this before.

MarcelWepper commented 5 years ago

Is there any update on this topic? Did you use the alternative by rendering an other navbar?

mwoz123 commented 4 years ago

I'd love to see such feature. Guy's did you work around that?

alainkaiser commented 2 years ago

@juanlet Any news on this one? How did you solve it?

Fauzdar1 commented 2 years ago

@mauricevancooten No updates since then? Any solution so far?

sysotel commented 2 years ago

+1

Jxmedia commented 9 months ago

Dam nothing on this? interested as well