When I send the user to a URL (in this case /login and /signup and then back to /) the elements on my page don't load automatically by entering the URL, I instead have to manually refresh in order for the content to load.
This is my index.js which handles the routes (with react router v6)
import Navbar from "./components/navbar/navbar";
import Footer from "./components/footer/footer";
import Home from "./pages/home/home";
import Login from "./pages/user/login/login";
import Signup from "./pages/user/signup/signup";
ReactDOM.render(
<div>
<Navbar />
<BrowserRouter>
<Routes>
<Route index path="/" element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
</Routes>
</BrowserRouter>
<Footer />
</div>,
document.getElementById("root")
);
This is an example of what happens when I send the user to /login with the use of the Link component that I am importing through React-router. Before refreshing the URL on /login
I then have to manually reload the page by pressing the reload button, only after doing so the content will load. After refreshing the URL on /login
the same applies if I try to go back to the homepage using the Link component Before refreshing on the URL /
I then have to reload in order to remove the login box After refreshing on the URL /