Closed Vidit92 closed 4 years ago
That's because there's no hash for it to scroll to when you click Home. Whenever you want to scroll, the element you want to scroll to has to have an id
that matches the hash in the link. You could add a id="home"
to the top element, and use <Link to="/#home">Home</Link>
for the link.
<Link to="/">Home</Link>
<Link smooth to="/#sectiontwo">Two</Link>
<Link smooth to="/#sectionthree">Three</Link>
The link to the hash is working perfectly, but after I have scrolled to the hash and when I click Home it is expected to scroll back to the top, but nothings happens.
Please help, me find the solution to these problem. CodeSandbox: https://codesandbox.io/s/busy-sinoussi-7w73c