Snippet

L'exportation «usehistory» (importée comme «usehistory») n'a pas été trouvée dans «React-Router-Dom»

3 réponses de la communauté

import {useNavigate} from 'react-router-dom';
const navigate = useNavigate();
navigate('/home')
import { useNavigate } from 'react-router-dom';
const navigate = useNavigate();
navigate('/home');
//In react-router-dom v6 useHistory() is replaced by useNavigate().

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