-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Dev Tools + ReactDOMServer.renderToStaticMarkup()
throws "React DOM tree root should always have a node reference"
#682
Comments
ReactDOMServer.renderToStaticMarkup()
throws React DOM tree root should always have a node referenceReactDOMServer.renderToStaticMarkup()
throws "React DOM tree root should always have a node reference"
Do you mean you’re calling |
👍 We do so to generate safe HTML and feed it to a util that only accepts HTML strings, a use-case for which I've seen |
I wouldn't recommend it because ReactDOMServer is basically a complete separate reimplementation of ReactDOM in the future versions. Instead, you can use (This is unrelated to the fix—just suggesting a recommended approach.) |
This is fixed in React DevTools 2.1.7 which will appear on Chrome addon store within an hour. https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi Cheers! |
That's great advice, we'll probably end up doing that. Thanks a bunch for that and the speedy new release! 👌 |
Starting one day ago, which seems to coincide with the latest release of the React Dev Tools on Chrome, I've started seeing the following error in a project that makes a few calls to
ReactDOMServer.renderToStaticMarkup()
for rendering static markup inside html tooltips.Seeing the React Dev Tools in the trace, I flipped it on/off and tried to repro, expecting to see a correlation. It was a bit too sporadic to know for sure if the Dev Tools were the actual cause, but other users have reported the same issue with React Dev Tools (in facebook/react#6232#issuecomment-298708568, which is why I'm cross-posting in the right repo). This + the date make me pretty confident that the two are linked.
This is happening with both dev and prod builds of React, so if this indeed impacts all React Dev Tools users visiting apps that make use of
ReactDOMServer
on the client, this could be pretty severe.Happy to provide any more info if needed!
The text was updated successfully, but these errors were encountered: