Render async iterables
Besides promises, JSX children can be async iterables, e.g. an async generator. Their items are rendered in order as they arrive. The markup rendered so far is sent to the browser while waiting for the next item. Reload to watch it again.
A component can be an async function* which yields JSX. This is a natural fit for paginated APIs or database cursors: the next page is only loaded when the renderer needs it, and each page is streamed as soon as it is ready. If the browser stops loading the page, the generator is stopped like a for await loop on break, so its finally block runs and can release resources.
| # | Release | Page | Flushed after |
|---|---|---|---|
| 1 | v1.0.0 | 1 | 702 ms |
| 2 | v1.1.0 | 1 | 702 ms |
| 3 | v1.2.0 | 1 | 702 ms |
| 4 | v1.3.0 | 2 | 1402 ms |
| 5 | v1.4.0 | 2 | 1402 ms |
| 6 | v1.5.0 | 2 | 1402 ms |
| 7 | v1.6.0 | 3 | 2103 ms |
| 8 | v1.7.0 | 3 | 2103 ms |
| 9 | v1.8.0 | 3 | 2103 ms |
| 10 | v1.9.0 | 4 | 2804 ms |
| 11 | v1.10.0 | 4 | 2805 ms |
| 12 | v1.11.0 | 4 | 2805 ms |
| 13 | v1.12.0 | 5 | 3506 ms |
| 14 | v1.13.0 | 5 | 3506 ms |
| 15 | v1.14.0 | 5 | 3506 ms |
All done after 3506 ms.