[Bug]: Next button throws a runtime error instead of cycling to the first sculpture
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, react
- Ambito
- documentation, frontend
Direzione di ricerca
Apri la pagina State: A Component's Memory e ispeziona l'esempio Sculpture Gallery, quindi riproduci l'errore facendo clic su Next su sculpture 12 of 12. Traccia l'aggiornamento dell'indice dell'esempio e verifica che la galleria torni alla prima scultura senza accedere a una voce non definita.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- JavaScript
- Stelle
- 11.8k
- Fork
- 7.9k
- Merge medio
- 16h 6m
- PR unite (30g)
- 7
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.
Altre issue di reactjs/react.dev
-
type: documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
-
type: typos
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
bug: unconfirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100