Last active
September 4, 2019 09:25
-
-
Save JakeGinnivan/b5e4f0774af391261ff9439c4c0cfc4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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