Importieren Sie UseShistory React-Router-Dom Version 6
import {useNavigate} from 'react-router-dom';
const navigate = useNavigate();
navigate('/home')
Zealous Zebra
import {useNavigate} from 'react-router-dom';
const navigate = useNavigate();
navigate('/home')