I have a React.js project with a simple sign in function. After the user is authorized, I call history.push method which changes the link in the address bar but does not ren
First, create a history object used the history package:
// src/history.js
import { createBrowserHistory } from 'history';
export default createBrowserHistory();
Then wrap it in in Main Router Component.
import { Router, Route, Link } from 'react-router-dom';
import history from './history';
ReactDOM.render(
)
Here, After dispatching the request, redirecting to home page.
function requestItemProcess(value) {
return (dispatch) => {
dispatch(request(value));
history.push('/');
};
}
should be helpful :)