ReactJs Access React Router history stack reactjs access environment variables,reactjs access window object,reactjs access

I have an application where you arrive at a photo album listing via various means (searching, drill down by category, etc). From the album, you click open individual photos and iterate through them using left/right arrows, as well as various editing tools. Each of the iterate/tool actions does a history.push() to add the route to the router history. I am trying to implement a button that will go back to the exact place in the history before you started viewing individual photos. To do that, I'd like to walk the history stack backwards to the point where the the history matches 1 of several patterns then do a history.go(-14) (or whatever) to jump back to the route that started the whole chain.

I've been searching the React router code as well as the HTML5 History object and I don't see any way of accessing the history stack directly so I can walk it back. I'd rather not depend on making each individual photo action push their path to a separate place since that makes it fragile (each photo action is built by a different developer and adding new actions in the future will require previous knowledge to remember to do that).

I can't go to a hard coded path because that would be pushed to the top of the history stack and hitting back arrow would just return you to the last individual photo page instead of the search page that generated the album list in the first place.

Any suggestions on accessing the history stack?

Answer:1



  1. reactjs access environment variables
  2. reactjs access window object
  3. reactjs access dom element
  4. reactjs access child state from parent
  5. reactjs access public folder
  6. reactjs access state of a component
  7. reactjs access camera
  8. reactjs access props in function

onPress of login button, I want to navigate to some other screen basically a home screen with authentication taking username and password. I am using a stack navigator but when I click on login ...

onPress of login button, I want to navigate to some other screen basically a home screen with authentication taking username and password. I am using a stack navigator but when I click on login ...

I believe this is a very simple question, but I am not accustomed to Async/callback world. I made PrivateRoute in order to protect my resource from being shoot by unauthenticated user. If I check ...

I believe this is a very simple question, but I am not accustomed to Async/callback world. I made PrivateRoute in order to protect my resource from being shoot by unauthenticated user. If I check ...