I am using React-router 3.2.0
so I have a button in the application on which I called goBack function of hashHistory as below
Router.hashHistory.goBack();
I works fine but I need to add some condition before it called. So my problem is like if I move between 3 links
- Home
- Dashboard
- Settings
Initially it will be on Home
then I moved to Dashboard
then Settings
. Now I clicked on button on which I called goBack()
function at that time current history location is Settings
it moved to Dashboard
then Home
after reaching at Home
there is no such history locations exist.
So this is I need to check is there any history location still exist or not. Something like
if(/*history exist*/){
call goBack();
} else {
//do my stuff
}
Is there any way to do that in react-router 3.2.0 version ?