Resetting state docs improvement
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 11.8k
- Forks
- 7.9k
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 11
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza por la sección enlazada «Option 1: Rendering a component in different positions» y revisa su diagrama y explicación de los hijos condicionales. Compara la redacción con la forma en que React trata los false children y las posiciones en el árbol. Se considera terminado cuando el diagrama y el texto explican correctamente los tres casos sin dar a entender que la colocación visual a la izquierda o a la derecha define la identidad de un hijo.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, react
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100