Need help with back button omdbapi

When the user search for a movie it gives them a list of movies that matches the search term So when they click on the movie it takes them to another page that contains information about that movie. In this pages I have back button so when you click on that button it should take you to the last page where you left but in my case it takes you to the first page. for instance: if you click on the movie on third page and then press the back button on that page to go back to the third page instead it takes you to the first page. This is the link to my github repo. please navigate to line 230 of index.js file. Any help appreciated.

Well, might not be the best solution but you could try to use LocalStorage.
When the user searches, store the query in there. When the back button is pressed, get the query and load new results.

Again, there are probably better results out there

I’ve implemented the pagination functionality where I grab data from external api and then output the result in multiple pages . The next and previous button works fine when navigation through the pages. But when you try to go back after clicking on a movie it always goes to the first page instead of the last page.