I use React Router Version 6 then I ran this code below:
import { useHistory } from 'react-router-dom'
function Test() {
const history = useHistory();
history.push('/');
history.replace('/');
history.goBack();
}
Test();
But I got this error:
Uncaught TypeError: (0 , react_router_dom__WEBPACK_IMPORTED_MODULE_2__.useHistory) is not a function
Are there any mistakes for my code?