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
Re-export ReactDOMServer's renderToString and renderToStaticMarkup methods in this module so it becomes a drop-in replacement for ReactDOMServer.
constReactDOMServer=require('react-async-ssr');// Original sync methodsReactDOMServer.renderToString(e);ReactDOMServer.renderToStaticMarkup(e);// Async methodsawaitReactDOMServer.renderToStringAsync(e);awaitReactDOMServer.renderToStaticMarkupAsync(e);
Or create alternative sync methods which do the same as ReactDOMServer's methods, but handle Suspense (but suspend all Suspense elements, since it can't wait for promises to resolve).
The text was updated successfully, but these errors were encountered:
This is a good idea. In my app I have two react roots, one for the head (which I render to static markup) and one for the body, which would use react-async-ssr.
Hi. I'm sorry to say that, having thought about it, I don't want to re-export .renderToString and .renderToStaticMarkup from ReactDOM.
I think it's better to reserve these method names for possible future sync implementations which could partially-support Suspense by immediately rendering the fallback.
It'd be nice to be able to import all the methods from one package, but I don't think it's such hardship to do import from 'react-dom/server'.
Sorry to disappoint you.
overlookmotel
changed the title
Add ReactDOMServer's renderToString and renderToStaticMarkup to exports?renderToString and renderToStaticMarkup sync methods
Sep 14, 2019
Re-export
ReactDOMServer
'srenderToString
andrenderToStaticMarkup
methods in this module so it becomes a drop-in replacement forReactDOMServer
.Or create alternative sync methods which do the same as
ReactDOMServer
's methods, but handleSuspense
(but suspend allSuspense
elements, since it can't wait for promises to resolve).The text was updated successfully, but these errors were encountered: