question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v8 dev mode: Warning: Prop `dangerouslySetInnerHTML` did not match. Server

See original GitHub issue

Bug report

Describe the bug

Only in development mode with version 8 i got this strange message in console log:

index.js:1 Warning: Prop dangerouslySetInnerHTML did not match. Server: “” Client: “\nvar WebFontConfig = {\n\tgoogle: {families: [ ‘Fjalla+One|Open+Sans:400,500,700’ ]}\n};\n(function() {\n\tvar wf = document.createElement(‘script’);\n\twf.src = (‘https:’ == document.location.protocol ? ‘https’ : ‘http’) + ‘😕/ajax.googleapis.com/ajax/libs/webfont/1/webfont.js’;\n\twf.type = ‘text/javascript’;\n\twf.async = ‘true’;\n\tvar s = document.getElementsByTagName(‘script’)[0];\n\ts.parentNode.insertBefore(wf, s);\n})();\n\t\t\t”

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. git clone -b v8.1.0 https://github.com/badpenguin/nextjs-static-generator-boilerplate.git
  2. yarn install
  3. yarn run dev
  4. navigate to http://localhost:3000/credits

Additional context

The script tag with dangerous html generating the message is here: https://github.com/badpenguin/nextjs-static-generator-boilerplate/blob/v8.1.0/src/lib/NextGoogleFont.tsx its the one where i use vanillaJS to load webfonts.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
kszittcommented, Aug 13, 2020

<p dangerouslySetInnerHTML={{__html: item.content}}/>
change to <div dangerouslySetInnerHTML={{__html: item.content}}/>.
the problem is solved

6reactions
sagar-gavhanecommented, May 22, 2020

This article helps to figure out why it’s throwing this issue.

https://flaviocopes.com/react-fix-dangerouslysetinnerhtml-did-not-match/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js - Warning: Prop `dangerouslySetInnerHTML` did not ...
I wonder if the characters \" and \n in medium posts are causing problems. Dev.to posts has \" character. The error only on...
Read more >
15 Warning: Prop dangerouslySetInnerHTML did not match.
Chapter Fifteen: Fix Prop dangerouslySetInnerHTML did not match In Next.jswarning: prop href did not match server client nextjs, ...
Read more >
Fix Prop dangerouslySetInnerHTML did not match In Next.js
https://v8.dev/docs/embed: Persistent handles provide a reference to a heap-allocated JavaScript Object, just like a local handle. There are two flavors, ...
Read more >
How to fix the `dangerouslySetInnerHTML` did not match error ...
I was trying to print the HTML contained in a prop, using dangerouslySetInnerHTML , while I got this error in the browser console:...
Read more >
<strong> is not match `dangerouslysetinnerhtml` - You.com
Only in development mode with version 8 i got this strange message in console log: index.js:1 Warning: Prop dangerouslySetInnerHTML did not match. Server: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found