Came across this warning when using dangerouslySetInnerHTML
on ReactJS.
Warning: Prop `dangerouslySetInnerHTML` did not match. Server...
Here is the snippet that causes the problem:
Notice how I set input holding the <p>
tag value as string, to a <p>
tag on the JSX.
The fix is simple, just change the <p>
tag on the JSX to a <div>
, like so
Not only it fixes the warning, it also more semantically correct on HTML.