O UseHistory não é exportado do React-Router-Dom
In react-router-dom V6 useHistory() is replaced by useNavigate()
you can use:
import {useNavigate} from 'react-router-dom';
const navigate = useNavigate();
navigate('/home');
KostasX