跳至主要内容

同步控制

同步控制另一個 Bear React Carousel

import BearCarousel from "bear-react-carousel";

const SyncCarousel = () => {
const syncCarouselRefA = React.useRef<BearCarousel>(null);
const syncCarouselRefB = React.useRef<BearCarousel>(null);

return <div>
<BearCarousel
// ...ignore some
ref={syncCarouselRefA}
syncCarouselRefs={[syncCarouselRefB]}
/>
<BearCarousel
// ...ignore some
ref={syncCarouselRefB}
syncCarouselRefs={[syncCarouselRefA]}
/>
</div>
}

試試看拖動 其中一個?