fromITzerotoIThero / personal-website

My personal website of a front-end developer in progress
0 stars 0 forks source link

Switching to NavLinks - navigation doesn't work #4

Closed fromITzerotoIThero closed 1 year ago

fromITzerotoIThero commented 1 year ago

W.,

Another issue - I've switched from classical a elements to NavLinks, but for some reason it broke the navigation.

I'd very much appreciate your advice - can be general, for the direction to go.

piotrwicijowski commented 1 year ago

Hmm it seems that my assumptions that "using #id would just work" was false. There has been an old ongoing issue with react router, and it seems they don't support it. So you have two options:

  1. Get back to using <a>
  2. Use another npm package https://github.com/rafgraph/react-router-hash-link that has this feature implemented
fromITzerotoIThero commented 1 year ago

Oh thank you, I'll check out this hash-link library and decide on one of these :)