Document we should probably use React.memo under our Context Provider
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 11.8k
- Fork
- 7.9k
- Merge medio
- 1g 11h
- PR unite (30g)
- 11
Descrizione
It is not immediately obvious that when the component that declares the context provider re-renders, all its descendants will also render, and not just the components that subscribe to the context.
This has been made explicit by @sophiebits on Twitter: https://twitter.com/sophiebits/status/1228942768543686656, and @markerikson on his blog: https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/#context-updates-and-render-optimizations, but following the right people on twitter should not be a requirement to understand how React is supposed to be used.
While it's true that if one reasons about how React decides to render components (given one has a sufficient understanding of it) this behaviour can be inferred, I still think that an explicit recommendation would help a majority of React users.
Happy to try submitting a PR if needed :)
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
Non è indicato alcun file o test specifico. Individua le indicazioni su React Context Provider nella documentazione di react.dev e rivedi i riferimenti al rendering collegati; il lavoro è completato quando la documentazione spiega chiaramente i nuovi rendering dei discendenti ed espone la raccomandazione prevista su React.memo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100