Routing to same page with anchors

Viewed 184

I'm new to react router and currently implementing a page with navigation. The top part is navigation followed by content part.

Currently when someone clicks on localhost:8080/page it renders a component in the content part. On click on one of the nav items page redirects to localhost:8080/page#my-anchor also the content below renders another component.

When clicking back button, the URL changes to localhost:8080/page but the content doesn't get updated.

How to handle the update of content with browser back & forward buttons?

0 Answers
Related