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 just realized that the way I was using the new hydrateRoot API was completely wrong. Unfortunately, React issued no warnings when omitting the initial children like so
I was hoping for some kind of symetry between createRoot and hydrateRoot which was enforced by the fact that hydratedRoot.render(ui) would actually issue hydration warnings (on the render() call not during hydrateRoot()):
constcontainer=document.getElementById("root");container.innerHTML=renderToString(<input/>);// no hydration warningconstroot=hydrateRoot(container);// now we do get a hydration warningroot.render(<h1/>)
Maybe this is me just being silly but I would've hoped for a hydration warning on hydrateRoot. Otherwise there's no apparent indication (in an untyped world) that hydrateRoot(container).render(initialUI) is most likely not what you wanted.
The text was updated successfully, but these errors were encountered:
now issues both a warning for incorrect usage of hydrateRoot and a recoverable error because root.render issues an early update before hydration could finish i.e. it hits both #23356 and #23319.
I just realized that the way I was using the new
hydrateRoot
API was completely wrong. Unfortunately, React issued no warnings when omitting the initial children like soI was hoping for some kind of symetry between
createRoot
andhydrateRoot
which was enforced by the fact thathydratedRoot.render(ui)
would actually issue hydration warnings (on therender()
call not duringhydrateRoot()
):Maybe this is me just being silly but I would've hoped for a hydration warning on
hydrateRoot
. Otherwise there's no apparent indication (in an untyped world) thathydrateRoot(container).render(initialUI)
is most likely not what you wanted.The text was updated successfully, but these errors were encountered: