We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- React
- Components
- Slideshow
- Discussions
Slideshow
Slideshow
Sort by
recency
|
28 Discussions
|
Please Login in order to post a comment
Error line reported does not point to the actual error.
`
My Solution:
import React, { useState, } from "react";
function Slides({ slides }) {
const [currentIndex, setCurrentIndex] = useState(0);
const goToNext = () => { if (currentIndex < slides.length - 1) { setCurrentIndex(currentIndex + 1); } };
const goToPrev = () => { if (currentIndex > 0) { setCurrentIndex(currentIndex - 1); } };
const restart = () => { setCurrentIndex(0); };
return ( Restart Prev Next {slides[currentIndex].title} {slides[currentIndex].text}
); }
export default Slides;
My solution:
My Solution:
My solution: