We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d58ca81 commit a76a598Copy full SHA for a76a598
1 file changed
src/content/learn/adding-interactivity.md
@@ -94,9 +94,14 @@ import { sculptureList } from './data.js';
94
export default function Gallery() {
95
const [index, setIndex] = useState(0);
96
const [showMore, setShowMore] = useState(false);
97
+ const hasNext = index < sculptureList.length - 1;
98
99
function handleNextClick() {
- setIndex(index + 1);
100
+ if (hasNext) {
101
+ setIndex(index + 1);
102
+ } else {
103
+ setIndex(0);
104
+ }
105
}
106
107
function handleMoreClick() {
0 commit comments