[Bug]: Next button throws a runtime error instead of cycling to the first sculpture
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
On the State: A Component's Memory page, the Sculpture Gallery example allows users to navigate through sculptures using the Next button. The gallery works correctly while navigating through valid entries, but when the user clicks Next on the final sculpture (12 of 12), the application does not cycle back to the first sculpture.
Instead, the index exceeds the sculpture list bounds, making sculpture undefined and causing the runtime error:
App.js: can't access property "name", sculpture is undefined
Expected: The gallery should wrap around from the last sculpture to the first sculpture when Next is clicked.
Actual: The application throws a runtime error because it attempts to access properties such as sculpture.name on an undefined object.
Affected screen: React.dev → Learn React → Adding Interactivity → State: A Component's Memory → Sculpture Gallery example.
Page
https://react.dev/learn/state-a-components-memory
Details
No response
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
Abre la página State: A Component's Memory e inspecciona el ejemplo Sculpture Gallery; después, reproduce el error haciendo clic en Next en sculpture 12 of 12. Sigue la actualización del índice del ejemplo y verifica que la galería vuelva a la primera escultura sin acceder a una entrada indefinida.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, react
- Área
- documentation, frontend
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 74/100