Closed 615349 closed 4 years ago
I have below snippet
const [swiper, updateSwiper] = useState(null); useEffect(() => { if (swiper !== null) { const onSlideChangeHandler = () => onSlideChange(swiper.realIndex); swiper.on('slideChange', onSlideChangeHandler); return () => { swiper.off('slideChange', onSlideChangeHandler); }; } }, [onSlideChange, swiper]); const params = { initialSlide: currentIndex, getSwiper: s => updateSwiper(s), shouldSwiperUpdate: true };
so I have one params to get the swiper instance, and have callback on swiper slide change, but in the latest 4.0.0, getSwiper is removed.
params
getSwiper
what is the replacement? why cannot it be backward compatible?
Let use ref instead. You can find more info from README
ref
I have below snippet
so I have one
params
to get the swiper instance, and have callback on swiper slide change, but in the latest 4.0.0,getSwiper
is removed.what is the replacement? why cannot it be backward compatible?