Photo by Joan Gamell on Unsplash

Came across this warning when using on ReactJS.

Warning: Prop `dangerouslySetInnerHTML` did not match. Server...

Here is the snippet that causes the problem:

Notice how I set input holding the tag value as string, to a tag on the JSX.

The fix is simple, just change the tag on the JSX to a , like so

Not only it fixes the warning, it also more semantically correct on HTML.

Felix Lee

Software Engineer in Singapore

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store