react-router-dom usehistory undefined code example
Example: useHistory react-router-dom
In react-router-dom version 6
useHistory() is replaced by useNavigate() ;
import {useNavigate} from 'react-router-dom';
const navigate = useNavigate();
navigate('/home')