React renders differently on server and client.
See original GitHub issueI have read #3152 and #3879 but this seemed like maybe another but related problem.
When the browser tries to bootstrap React and rerender the page I get this warning.
Warning: React attempted to reuse markup in a container but the checksum was invalid.
This generally means that you are using server rendering and the markup generated on
the server was not what the client was expecting. React injected new markup to compensate
which works but you have lost many of the benefits of server rendering. Instead, figure
out why the markup being generated is different on the client or server:
(client) e6zyboqo.1.2.1.0.1">"This is a
(server) e6zyboqo.1.2.1.0.1">"This is a test
Apart from the case that it is unnecessary to escape the quote it seems to render differently on the server and browser. This is just static content so I don’t really understand why?
The markup to render the element is like this.
<p><strong>Next:</strong>"This is a test"</p>
How come it’s rendered different?
Issue Analytics
- State:
- Created 8 years ago
- Comments:24 (11 by maintainers)
Top Results From Across the Web
reactjs - Render different components on client and server side
I am currently developing a website where I have used react, react-router and redux. We are doing Server side rendering and using react...
Read more >Flash component renders differently in server vs client #1773
Bla When rendered in NextJS on the server, the HTML it generates becomes: ... Flash component renders differently in server vs client #1773....
Read more >Client Side Rendering Vs Server Side Rendering in React js ...
In server-side rendering when a user makes a request to a webpage, the server prepares an HTML page by fetching user-specific data and...
Read more >Client-Side Rendering vs. Server-Side Rendering - Shakacode
You may want different code for your server-rendered components running server side versus client side. For example, if you have an animation that...
Read more >Client-side vs. server-side rendering: why it's not all black and ...
Server -side rendering is the most common method for displaying information onto the screen. It works by converting HTML files in the server...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is this issue about mismtach caused by character encoding (@vlinder) or attribute ordering changed by object.assign (@mridgway)?
I am seeing a similar issue as @mridgway that in some cases the props key ordering is changed by object.assign and then by using the spread operator to specify them causes the server the client to render the attributes in different order.
Since the spec doesn’t specify the ordering the keys in an object, it seems pretty fragile that we take the attribute ordering into account when determining if there is a mismatch. The other way is to have the spread operator returns a consistent ordering, but not sure how you can do that except doing a sort on the keys, which is pretty costly.
@mridgway
Ah!! That sounds like a really good reason for me seeing this warning:
I have an isomorphic app so I can’t see a reason key ordering should be different… except for what you are saying here. Thanks!