What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-12 10:07:35
detect browser back button click react
import { useHistory } from 'react-router-dom' const [ locationKeys, setLocationKeys ] = useState([]) const history = useHistory() useEffect(() => { return history.listen(location => { if (history.action === 'PUSH') { setLocationKeys([... Add solution -
Javascript 2021-10-23 04:18:13
How to pass params with history.push?
import { useHistory } from "react-router-dom"; const FirstPage = props => { let history = useHistory(); const someEventHandler = event => { history.push({ pathname: '/secondpage', search: '?query=abc'... Add solution