Result from stock exchange (took 500 ms)
rendered after 500 msStreaming vs. string rendering
Jeasx streams JSX by default: the page shell is flushed immediately and slow parts follow as soon as they are ready. In v2, the complete markup was rendered to a string first and sent in one go.
Switch between both modes and compare the numbers below. When streaming, the first byte arrives almost instantly and the results appear one after another. When rendering to a string, the browser waits for the slowest result before it receives anything at all.
The guard of this example shows how to restore the former string rendering in userland: it wraps this.jsxToString and calls jsxToString from jsx-async-runtime when a route sets this.jsxStream = false.
Slow sources
rendered on the serverLoading stock exchange...
Loading news feed...
Result from news feed (took 1000 ms)
rendered after 1000 msLoading weather service...
Result from weather service (took 1500 ms)
rendered after 1501 msMeasured by your browser
streaming mode- First byte
- …
- Complete page
- …