A component to scroll page to anchor element for React Router.
This component can be used instead of https://github.com/rafgraph/react-router-hash-link package.
The AnchorScroller component is much more simple that react-router-has-link that requires timeout and MutationObserver. This component will wait for all it's children to be rendered before triggering the useEffect method that will try to find an element in the document that match the url hash, and scroll it into view.
This component has the following advantage:
- You don't have to replace your
Linkcomponent toHashLink - It works out-of-the-box with
useNavigate - It also work out-of-the-box on page load