[Suggestion]: Providing formal definition of equality of two JSX values or giving a clarity if there is no formal definition possible.
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
Summary
Formal Definition of Equality of two JSX values. If there is no formal definition possible then give practical guidelines.
Page
https://react.dev/learn/keeping-components-pure
Details
React documentation on "Keeping Components Pure" says that
React assumes that every component you write is a pure function. This means that React components you write must always return the same JSX given the same inputs.
It also mentions:
React offers a “Strict Mode” in which it calls each component’s function twice during development. By calling the component functions twice, Strict Mode helps find components that break these rules.
However, the page does not provide a formal definition of what it means for two JSX values to be "equal."
we can easily say 4 === 4 or "foo" === "foo",
But, To give a simple example, how do we define the equality of two JSX values like: "<Child {childConfig}="object1"> and <Child {childConfig}="object2">"
If object1 and object2 are deeply equal, does that imply that both JSX elements are considered equal as well? Or is equality based on referential identity of object1 and object2?
I think, This distinction is important to understand what it truly means of two JSX values being same.
If such a definition exists elsewhere in the React documentation, it would be helpful to reference it explicitly from this page to clarify expectations around JSX equality and purity.
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 con la página “Keeping Components Pure” enlazada en el issue y revisa su explicación de las entradas iguales y los resultados JSX. Aclara si la igualdad de JSX debería definirse formalmente o reemplazarse por una guía práctica sobre la identidad de objetos y la igualdad profunda, y añade una referencia o explicación explícita para que los lectores sepan qué significa “el mismo JSX”.
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
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100