react-dom/server: clarify when `renderToPipeableStream` is appropriate
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 11.8k
- Fork
- 7.9k
- Merge medio
- 1g 11h
- PR unite (30g)
- 11
Descrizione
At https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream we see this note:
This is a Node.js specific API and modern server environments should use renderToReadableStream instead.
I initially read this as saying "use renderToReadableStream in any environment where web streams are available." This includes modern versions of Node: https://nodejs.org/api/webstreams.html.
But going to the main React 18 release notes page https://reactjs.org/blog/2022/03/29/react-v18.html#react-dom-server, we see that there is a different distinction being made.
renderToPipeableStream: for streaming in Node environments.
renderToReadableStream: for modern edge runtime environments, such as Deno and Cloudflare workers.
(Aside: is Deno really an "edge runtime environment"? 🤔 )
Combined with @sebmarkbage's outlining of the downsides of web streams here https://github.com/reactwg/react-18/discussions/91, it seems clear that renderToPipeableStream should always be preferred in Node environments. It'd be nice if the docs clearly spelled this out.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla documentazione collegata di renderToPipeableStream e confrontane la formulazione con le note di rilascio di React 18 e la discussione collegata sui web streams. Chiarisci la distinzione tra gli ambienti Node e gli edge runtime e verifica che la nota rivista non implichi più che le versioni moderne di Node debbano usare renderToReadableStream.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 58/100