You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, here's my problem: I'm trying to set up SSR on a project that works perfectly with SPA. Once the SSR is in place, it works, but only halfway, let me explain. When I go to the main page "/" http://localhost:3000/ the page is displayed correctly, then if from the main page I go to a child page, it still seems to work. But if I refresh the child page from the browser (F5) or go directly to the child page without going to the main page, I get 2 pages displayed one below the other.
To understand what I'm talking about, here's my route configuration (for your information, I also use the outlet function in my main layout) :
So when I try to go directly to http://localhost:3000/login I get the "Home" page and below it the "Login" page. This behavior occurs on all children's routes. Why is the "Home" page loaded every time I go to a child route?
I'd like to make one more important point. I'm currently using version 6.4.3 of react-router-dom. But if I update to the latest version (6.12.1), it's even worse! With the latest version, it's impossible to go to a child page from the main page, although the URL in the browser changes, but doesn't refresh, so I have to refresh the page myself with F5. But then, I still have the same problem with my 2 pages being displayed.
I've been racking my brain for days, but I can't find a solution. Do you have any idea what I'm doing wrong? Thank you in advance for your help and sorry for my english. Best regards.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone, here's my problem: I'm trying to set up SSR on a project that works perfectly with SPA. Once the SSR is in place, it works, but only halfway, let me explain. When I go to the main page "/"
http://localhost:3000/
the page is displayed correctly, then if from the main page I go to a child page, it still seems to work. But if I refresh the child page from the browser (F5) or go directly to the child page without going to the main page, I get 2 pages displayed one below the other.To understand what I'm talking about, here's my route configuration (for your information, I also use the
outlet
function in my main layout) :So when I try to go directly to
http://localhost:3000/login
I get the "Home" page and below it the "Login" page. This behavior occurs on all children's routes. Why is the "Home" page loaded every time I go to a child route?What am I doing wrong?
On the client side, I use
BrowserRouter
:On the server side, I use
StaticRouter
:However, I have based myself on the official documentation Server Side Rendering
I'd like to make one more important point. I'm currently using version
6.4.3
of react-router-dom. But if I update to the latest version (6.12.1
), it's even worse! With the latest version, it's impossible to go to a child page from the main page, although the URL in the browser changes, but doesn't refresh, so I have to refresh the page myself with F5. But then, I still have the same problem with my 2 pages being displayed.I've been racking my brain for days, but I can't find a solution. Do you have any idea what I'm doing wrong? Thank you in advance for your help and sorry for my english. Best regards.
Beta Was this translation helpful? Give feedback.
All reactions