reactjs / reactjs/react.dev

Why don't we mention the concept of callBack props in the 'Lifting State Up' page?

Aperta
#5,306 0 commenti 0 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

There are times the source of the detailed or complete data is best isolated in a child component rather than trying to lift the state up and creating large parent component. The large parent component that has all the state, goes against the concepts of code isolation and separation of concerns,

Given this, why not add a note to https://reactjs.org/docs/lifting-state-up.html that talks about callback props?
There are 3 issues i'm aware of with callback props:

  1. that warning that the parent component is still rendering: solution: launch the event handler code asynchronously
    2): In async functions, after await(), we should check whether the component is still mounted.
    3): whenever a function is passed as a prop it must be frozen and then only added to the useEffect() dependency chain (better to add all dependencies for useEffect rather than ignore the warning)

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 pagina “Lifting State Up” all’indirizzo reactjs.org/docs/lifting-state-up.html e verifica in che modo le callback props si collegano alle indicazioni contenute. Valuta le tre preoccupazioni elencate nell’issue e determina se nella pagina debba essere inserita una nota accurata. Il lavoro è completo quando la documentazione include una spiegazione chiara e tecnicamente supportata oppure quando l’aggiunta proposta nell’issue viene rifiutata con una motivazione.

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

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.