useHistory is not exported form react-router-dom
snippet in javascript

useHistory is not exported form react-router-dom

user9073

In react-router-dom version 6 
useHistory() is replaced by useNavigate() ;

import {useNavigate} from 'react-router-dom';
const navigate = useNavigate();
navigate('/home')