I'm using react-router-dom
v6 and I wanna change the URL in order to change the route
We can use useNavigation()
hook in a component but I want to use something similar in a redex action
Also history
has a problem with react-router-dom
V6
import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
const App = () => {
return (
<div>
<Router>
<Routes>
<Route path="/" element={<MainPage />} />
<Route path="/second" element={<SecondPage />} />
</Routes>
</Router>
</div>
);
};
export default App;
my action is just a regular action
const action = () => {
//Here I want to change the route
}