Load data in parallel with async components

Components in Jeasx can be async and simply await their data. The renderer resolves them one after another, so three components that each wait one second take three seconds in total.

As JSX also accepts promises as children, you can kick off all requests up front and hand the pending promises to your markup. Now everything loads at the same time while the output order stays the same. The bars below show when each request started and finished.

Requests

sequential

Waiting for Ada...

Ada requested at +1 ms, loaded at +1002 ms

Waiting for Grace...

Grace requested at +1002 ms, loaded at +2004 ms

Waiting for Linus...

Linus requested at +2004 ms, loaded at +3006 ms
Rendered in 3006 ms