Browse Source

Fix runtime error in image gallery useState example (#5877)

main
Lukas Volk 2 years ago
committed by GitHub
parent
commit
a76a5984ec
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/content/learn/adding-interactivity.md

5
src/content/learn/adding-interactivity.md

@ -94,9 +94,14 @@ import { sculptureList } from './data.js';
export default function Gallery() {
const [index, setIndex] = useState(0);
const [showMore, setShowMore] = useState(false);
const hasNext = index < sculptureList.length - 1;
function handleNextClick() {
if (hasNext) {
setIndex(index + 1);
} else {
setIndex(0);
}
}
function handleMoreClick() {

Loading…
Cancel
Save