Resetting state docs improvement
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 11.8k
- Forks
- 7.9k
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 11
Description
Over here: https://react.dev/learn/preserving-and-resetting-state#option-1-rendering-a-component-in-different-positions
about resetting a state, just because a line is drawn to the right, now the Counter becomes a "right" child?
And then, just because the line is drawn to the left, now the Counter becomes a "left" child?
The diagram is:
In reality, it is just "children" nodes. So if you have one child with a line drawn to the left, it doesn't make it a "left" child.
Likewise, if you have one child with a line drawn to the right, it doesn't make it a "right" child.
To some degree, it dumbs down the programmers.
The truth is:
For those three situations in the diagram:
- First child is
Counter, and second child isfalse. (isPlayerA && whateverbecomesfalseifisPlayeris false). There should be a solid line going to afalseas a second child. - First child is
false, and second child isCounter. There should be a solid line going down to the first child which isfalse. - The third case is just like (1).
And then, the rule of React is, the false will not be rendered. But the tree in fact has a false, for the "tree structure" to be "different".
If I am not mistaken, this "tree" is composed, and compared to the previous "tree", for React to decide whether to change something in the actual DOM. This "current" tree and "previous tree", is the idea of Virtual DOM.
So the concepts should be set straight here.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par la section liée « Option 1: Rendering a component in different positions » et examinez son diagramme ainsi que son explication des enfants conditionnels. Comparez la formulation avec la manière dont React traite les false children et les positions dans l’arbre. C’est terminé lorsque le diagramme et le texte expliquent correctement les trois cas sans laisser entendre que le placement visuel à gauche ou à droite définit l’identité d’un enfant.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, react
- Domaine
- documentation
- Type d'issue
- Documentation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100