PirateApp
PirateApp

Reputation: 6230

The client-side rendered virtual DOM tree is not matching server-rendered content in Nuxt

Really appreciate if anyone can tell me what is causing this error

The client-side rendered virtual DOM tree is not matching server-rendered content.
This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. 
Bailing hydration and performing full client-side render.

Upvotes: 0

Views: 364

Answers (1)

Michal Lev&#253;
Michal Lev&#253;

Reputation: 37903

Well, the reason for The client-side rendered virtual DOM tree is not matching server-rendered content is probably the use of randomness - more specifically the usage of getRandomString function in the NewsList.vue component to generate unique ID's

As @kissu pointed out in his answer

any random is risky

new Date() inside NewsListItem.vue will cause problem too as the resuting Date object will be different on server and the client causing client side VDom difference from the HTML generated by server...

Upvotes: 1

Related Questions