Answers for "history back react"

Go
1

useHistory goback

import {useHistory} from "react-router-dom";

const history = useHistory();

<button onClick={() => history.goBack()}>Go Back</button>
Posted by: Guest on November-30-2020
0

history.back()

// --------------------if history.back() not working---------------------
//instead of this
<a href="javascript:history.back();">back</a>

//do this
<a href="javascript:history.go(-1);">back</a>
Posted by: Guest on February-17-2021
-1

how to go back in usinsg router hisotry

this.props.history.goBack(); //react-router (v4)
Posted by: Guest on November-10-2020

Browse Popular Code Answers by Language