Usehistory no se exporta desde react-router-doms

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