[Suggestion]: Add a note about the `use` API as an alternative to `useEffect`

Aperta Adatta ai principianti
#8,433 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
javascript, react
Ambito
documentation

Direzione di ricerca

Inizia leggendo la sezione «What are good alternatives to data fetching in Effects?» nella pagina useEffect e la sezione «Streaming data from the server to the client» nella pagina use. Chiarisci la relazione tra useEffect e use, inclusi i relativi compromessi, e aggiorna la documentazione in modo che i lettori possano individuare quando si applica ciascun approccio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: documentation
Summary

The section on the useEffect page about good alternative to fetching data is a great resource, but does not mention the use API at all. I recommend adding some text to clarify the existence of this option and any pros/cons.

Page

https://react.dev/reference/react/useEffect#what-are-good-alternatives-to-data-fetching-in-effects

Details

It is unclear from the documentation what the relationship between useEffect and use is. The useEffect page does not mention the use API at all, and neither does the use page. The useEffect page contains a section called “Fetching data with Effects”, and the use page contains a section called Streaming data from the server to the client. So, it sounds like both can be used for fetching data, but there is no acknowledgement of this or relevant guidance.

Lingua principale
JavaScript
Stelle
11.8k
Fork
7.9k
Merge medio
16h 6m
PR unite (30g)
7

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di reactjs/react.dev

Tutte le issue di reactjs/react.dev

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.