I'm using swiper.js library in my react app. I want to use slideTo method form swiper API but I don't know how can I do that.
Link to not working demo from swiper website
My code
const swiperRef = useRef(null)
useEffect(() => {
//...some logic
//if() {
swiperRef.current.slideTo(0);
//}
}
return(
<Swiper pagination={true} navigation={true} ref={swiperRef}>
)
TypeError: swiperRef.current.slideTo is not a function