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
|
13 Discussions
|
Please Login in order to post a comment
I successfully built this React-based slideshow for HackerRank, but I now want to integrate it into my WordPress photography website. Should I use a plugin like WP Reactivate or manually insert it using a shortcode?
import React, { useState } from 'react';
function Slides({ slides }) { const [currentSlide, setCurrentSlide] = useState(0);
const handleNext = () => { if (currentSlide < slides.length - 1) { setCurrentSlide(currentSlide + 1); } };
const handlePrev = () => { if (currentSlide > 0) { setCurrentSlide(currentSlide - 1); } };
const handleRestart = () => { setCurrentSlide(0); };
return ( Restart Prev Next {slides[currentSlide].title} {slides[currentSlide].text}
); }export default Slides;