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
Try to use custom history and Router instead of BrowserRouter. After installing history:
yarn add history
Create a custom browser history:
import { createBrowserHistory } from "history";
export default createBrowserHistory();
Use Router instead of BrowserRouter in your setup:
import history from "your_history_file";
ReactDOM.render(
,
document.getElementById('root')
);
or if you don't want to use a custom history file and import from there you can crate it directly in your index.js:
import { createBrowserHistory } from "history";
const history = createBrowserHistory();
ReactDOM.render(
,
document.getElementById('root')
);