Reactjs browser back button functionality | Sololearn: Learn to code for FREE!


Reactjs browser back button functionality

I have created one website using react now in homepage all sections are from api only footer is static one so when I navigate to next page and if I came back to homepage footer is loads first ideally it should go to the previous section which I was clicked to override this functionality plz any one help me and thanks in advance

6/11/2021 6:56:30 AM

Krishnaji Kulkarni

2 Answers

New Answer


you may use history.back() to navigate back with js.. no idea if you can use with react..try it once and leme know..


Krishnaji Kulkarni you can use react-router-dom to handle the url routing. Here i used stackblitz to rebuild a sample site similar to what you described with multiple pages nav links and simulated api fetch on each page load. Webpage: Reactjs codes: