ReadableStream as children

JSX children can be a ReadableStream, e.g. a streamed answer from an AI service or the decoded body of a fetch response.

Items are rendered in order as they arrive, and the markup rendered so far is sent to the browser while waiting for the next item.

How does Jeasx render a ReadableStream?

ReadableStreams are rendered chunk by chunk as they arrive. This text comes from a ReadableStream which emits one word every 60 ms. Text chunks are escaped like any other string, so <b>this markup</b> shows up as plain text. A fetch response body works the same way: response.body.pipeThrough(new TextDecoderStream()).

All done after 2966 ms

Ask again