Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some notes on the hash link stuff
(Before this PR: )
Hash links do not work well with React bc elements are often not yet available in DOM on load.
The behavior was slightly better in Firefox than in Chrome, but still suboptimal. (In Firefox it would only jump to the element whose id is in the hash if the page was already loaded and you hit enter on the browser url bar a second time; in Chrome, doing that would just refresh the page, and it never jumped to the relevant element. Plus other small subtle differences.)
Historically people used rafgraph/react-router-hash-link to solve this problem, but that is incompatible with React Router v6.
(This PR: )
Adds & uses React Hash Link https://www.npmjs.com/package/react-hash-link
(Notes: )
This didn't work: https://dev.to/mindactuate/scroll-to-anchor-element-with-react-router-v6-38op
This didn't work: https://ncoughlin.com/posts/react-router-v6-hash-links/
React Router Hash Link is the historical solution but doesn't work with React Router v6: https://www.npmjs.com/package/react-router-hash-link
...but one day it might?: rafgraph/react-router-hash-link#92 (comment)
React Router considers this functionality outside its domain: remix-run/react-router#7780 (comment)