reactjs / reactjs/react.dev

clarify when componentDidUpdate fires

Aperta
#1,135 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
11.8k
Fork
7.9k
Merge medio
1g 11h
PR unite (30g)
11

Descrizione

Re-posting this issue from facebook/react:
https://github.com/facebook/react/issues/2796

https://reactjs.org/docs/react-component.html#componentdidupdate is unclear on when it is called with regards to the render function.

The docs state that it's "Invoked immediately after updating occurs" but it is unclear what is meant with updating in this case: it can refer to either the component as a whole updating (meaning post-render), or it can refer to setState() having been processed (which might mean pre-render).

It would be good to explicitly state when this function fires in its documentation (even if somewhere else on the site this is described in text or graphic form already).

There was a PR for this that was merged at one point: https://github.com/facebook/react/pull/2801

But the current website does not include this change. I believe the language from the above PR is still correct and would be helpful to people since it's more specific than what's there currently.

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.

Direzione di ricerca

Inizia dalla sezione componentDidUpdate all’URL della documentazione dei componenti React citata nell’issue, quindi confronta la formulazione attuale con il linguaggio a cui si fa riferimento in facebook/react PR #2801. Aggiorna la documentazione in modo che la tempistica del callback rispetto al rendering sia esplicita e verifica che la pagina pubblicata contenga questa precisazione.

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

Valutazione

Stack tecnologico
react
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
1/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
50/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.