xxxxxxxxxx
import { useNavigate } from 'react-router-dom';
const navigate = useNavigate()
navigate('./create', { replace: true });
import { useNavigate } from 'react-router-dom';
function app() {
let history = useNavigate();
const redirect = () => {
history('/path')
}
return (
)
}
For React Router v6