Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to do anchor aka "hash" links? #1454

Closed
benknight opened this issue Jun 30, 2015 · 11 comments
Closed

How to do anchor aka "hash" links? #1454

benknight opened this issue Jun 30, 2015 · 11 comments

Comments

@benknight
Copy link

Say I have some <div id="my-section"> ... </div>, how do I link to this section of the page? This is a really useful feature of the web.

@benknight benknight changed the title How to do anchor links (linking to sections of a rendered page)? How to do anchor aka "hash" links? Jul 1, 2015
@mouhsinelonly
Copy link

+1

@benknight
Copy link
Author

I can't remember if I closed this because I found a duplicate issue or if I actually figured out how to do it. Anybody know the status of this feature?

@igl
Copy link

igl commented Sep 11, 2015

+1

I use history locations only and want the original behavior for hashlinks back!

@davis
Copy link

davis commented Oct 1, 2015

how do you do this?

@zdavis
Copy link

zdavis commented Oct 5, 2015

+1

@pratyushmittal
Copy link

@darobin Can you please provide details about how did you fix the normal anchor links? Using a[href="#some_id"] still calls createBrowserHistory() leading to a full React re-render.

@darobin
Copy link

darobin commented Oct 23, 2015

@pratyushmittal I haven't checked but I believe in my case it is also still re-rendering. After all, it does change the route. But it works: the browser navigates to the hash, which is the desired behaviour. In my case the re-render isn't an issue, the route only affects topmost components, the rest won't see the change.

@amadeogallardo
Copy link

I do see as problematic that the re-render is triggered, since navigating within sections on the same page then causes an unnecessary performance overhead.

Is there any supported way to prevent re-rendering while using named anchors to sections on the same page?

@pepavesely
Copy link

Any progress on this subject? I wonder why the issue is closed. React is still re-rendering pages.

@nujhong
Copy link

nujhong commented Dec 7, 2017

As a workaround, I think you can respond to LOCATION_CHANGE and perform reconciliation based on the hash property of the payload.

@akhilaudable
Copy link

Any progress here? If there is duplicate issue, can anyone please provide URL of that issue?

@lock lock bot locked as resolved and limited conversation to collaborators Feb 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests