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
|
31 Discussions
|
Please Login in order to post a comment
Here is a basic Javascript project for practice Stopwatch code in Javascript
Here is the cleaned up solution:
Functionality is working as expected but still test cses are failing due to it is not using
waitFor, screen
and also async await is not being used.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;