Navigating from another page
See original GitHub issueIs it possible to navigate from another page? (using react Router v5 with create-react-app)
For example i have this exmple that is working on the HomePage. But if i click the navbar item from another page it doesn’t work.
How i navigate to anchor from another page?
import { Element} from 'react-scroll';
export function HomePage() {
return (
<>
<title>Home</title>
<Banner />
<Element name="price-plan-list">
<PriceplanList />
</Element>
<Element name="entertainment-area">
<EntertainmentArea />
</Element>
</>
);
}
And this is the NavbarItem:
import { Link as AnchorLink } from 'react-scroll';
<NavItem key={index}>
<AnchorLink
activeClass="active"
to={item.link}
spy={true}
smooth={'easeInOutCubic'}
duration={1000}
offset={-50}
>
{item.title}
</AnchorLink>
</NavItem>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:13 (3 by maintainers)
Top Results From Across the Web
How To Navigate To Another Page In HTML - TalkersCode.com
In this tutorial we will show you the solution of how to navigate to another page in HTML and how you are able...
Read more >Navigate to a new screen and back - Flutter documentation
Navigate to a new screen and back · 1. Create two routes · 2. Navigate to the second route using Navigator.push() · 3....
Read more >How to navigate to other page in angular 6? - Stack Overflow
There more than two methods to navigate like navigate() , navigateByUrl() , and some other.. but we will mostly use these two. navigate()...
Read more >Navigate Between Pages | Learn Next.js
Navigate Between Pages ... So far, the Next.js app we created only has one page. Websites and web applications generally have many different...
Read more >How to navigate through my own page? When I click on 'About ...
A second option is to create your link as you normally would with your <a> tag and then style it via CSS: <a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I do not know if this will help you guys, but what I did (in create-react-app and react-router-dom) is to use a scroller.scrollTo in a setTimeout, example:
I have a page transition hence the 750 milliseconds, but i have tried as low a 1 and it still worked. This solution is kind of jank and I dont know if Search engine bots will like it.
Hi, I’ve found the package react-scrollable-anchor https://www.npmjs.com/package/react-scrollable-anchor really helpful. This allows to navigate and scroll to a specific section even from another page, just by using href anchor.