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

is there any way to use this in conjunction with react router? #4

Closed
chrisdobler opened this issue Oct 15, 2016 · 2 comments
Closed

Comments

@chrisdobler
Copy link

If the anchor is on a different page, is there any way to have it trigger the router?

@bySabi
Copy link
Collaborator

bySabi commented Oct 16, 2016

Before create this component I make another https://github.com/bySabi/react-router-hash-scroll that do the same on top of react-router Link. The time passed and I though this approach don't make too much sense that's why I rewrote it using anchors <a> tags. Animated scroll is a recurrent issue on react router without a clear solution, see: remix-run/react-router#394, probably due that scroll is a document DOM level stuff, far beyond the boundaries of pureness "React Component".

I don't know what you are trying to do but 'scroll' to a external link isn't possible with React Scrollchor right now. Initially I create this component thinking on landing pages but I open to go more far.

One solution to your use case could be: First load external page using router then scroll to it. If you are working with infinite scroll like page, maybe react-waypoint can trigger react-router page load.
Is you take a look at Scrollchor code, it is really simple and all the dirty DOM stuffs is apart on modules that can be reused. You can create your own solution with it and askme anything about this.

@bySabi
Copy link
Collaborator

bySabi commented Oct 29, 2016

closed due inactivity.

@bySabi bySabi closed this as completed Oct 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants