Skip to content

Routing weirdness when nesting #1825

Closed Answered by mkrtchian
szmarci asked this question in Q&A
Discussion options

You must be logged in to vote

This seems to be a hydration problem (mismatch between the React code rendered in the server, and the one rendered in the client).
When reloading with the weird behavior I get this error:

Warning: Prop className did not match. Server: "blue" Client: "red"

The Location state you are using is explained in the React Router V6 documentation here.
It is created on client side, and seems to be kept by your browser until you change the URL, or put the same URL by hand after changing it.

I guess that as Remix does not know that information on server side. When you hit reload, the server renders your page first thinking it's the Blue component. Then that comes to the client and is displayed imme…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ccssmnn
Comment options

@szmarci
Comment options

@ccssmnn
Comment options

Answer selected by szmarci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants