You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing React SSR and discovered that I have to use the following construct:
hydrateRoot(document.documentElement, <App/>);
not
hydrateRoot(document, <App/>);
as shown in the docs. If I try the latter I get hydration errors due to mismatches on top level tags like head or body. The App component returns <html> as the root, as it says to do in the docs.
The text was updated successfully, but these errors were encountered:
Of course, after wrestling with this for an afternoon I find the issue five minutes after filing a bug ... using document does work, but I was actually constructing the components with React.createElement and not adding null as a third parameter.
Summary
The example code for
hydrateRoot
seems to be wrong.Page
https://react.dev/reference/react-dom/server/renderToReadableStream#rendering-a-react-tree-as-html-to-a-readable-web-stream
Details
I am implementing React SSR and discovered that I have to use the following construct:
not
as shown in the docs. If I try the latter I get hydration errors due to mismatches on top level tags like head or body. The App component returns
<html>
as the root, as it says to do in the docs.The text was updated successfully, but these errors were encountered: