Usehistory n'est pas exporté de 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