const [isAuto, setIsAuto] = useState(false);
return (
<div>
<input type="checkbox" onChange={() => setIsAuto(!isAuto)}/>
<Swiper autoplay={isAuto}>...</Swiper>
</div>
)
const [ autoplay, setAutoplay ] = useState(false);
const swiper = useRef();
useEffect(() => {
swiper.current.autoplay[autoplay ? 'start' : 'stop']();
}, [ autoplay ]);
<input
type="checkbox"
checked={autoplay}
onChange={e => setAutoplay(e.target.checked)}
/>
<Swiper
onSwiper={instance => swiper.current = instance}
...
>