React: dangerouslySetInnerHTML not working in IE

Created on 18 Oct 2017  路  3Comments  路  Source: facebook/react

Hello,

Today I have spotted the bug(?) in IE10/IE11: while setting the inner HTML on any element (<p>, <div>, <span>) using dangerouslySetInnerHTML property the browser will raise an error Argument not optional.

I use this with SSR, but the actual HTML received from the server is good, so probably there's a problem with ReactDOM.hydrate func.

Some code:

<p dangerouslySetInnerHTML={{ __html: subTitle }} />

where label is some string that contains HTML.

image

Most helpful comment

React 16.1.0-beta has been released. Please update react, react-dom, and react-test-renderer (if you use it) to this version and let us know if it solved the issue! We鈥檇 appreciate if you could test before Monday when we plan to get 16.1.0 out.

All 3 comments

Hey! This was fixed in https://github.com/facebook/react/pull/10921 and is a known issue. A fix should be out in the next release.

However thank you for the great write up!

React 16.1.0-beta has been released. Please update react, react-dom, and react-test-renderer (if you use it) to this version and let us know if it solved the issue! We鈥檇 appreciate if you could test before Monday when we plan to get 16.1.0 out.

@gaearon Hi Dan, everything is working now, thank you!

Was this page helpful?
0 / 5 - 0 ratings