react router setting up back button to correct route code example
Example 1: react router go rprevious page
directly use (()=>this.props.history.goBack())
Example 2: how to go back in usinsg router hisotry
this.props.history.goBack(); //react-router (v4)