Skip to content

Instantly share code, notes, and snippets.

Last active September 4, 2019 09:25
What would you like to do?
// Note, doesn't deal with timeouts, infinite recursion, errors etc..
async function resolveAll(render, promiseTracker) {
const renderResult = render(promiseTracker)
if (promiseTracker.hasWork) {
await promiseTracker.waitForCompletion()
return resolveAll(render, promiseTracker)
return renderResult
// And finally we can use it:
resolveAll(() => ReactDOM.renderToString(<App />), new PromiseTracker())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment