Answer the question
In order to leave comments, you need to log in
How to style Swiper in styled components?
Can you please tell me how to style Swiper in styled components?
This styling method works, but the slider functionality stops working completely, although in react-router-dom these problems did not arise when styling Link
<Slider
spaceBetween={50}
slidesPerView={3}
onSlideChange={() => console.log('slide change')}
onSwiper={(swiper) => console.log(swiper)}
pagination={{ clickable: true }}
>
<SliderItem >Slide 1</SliderItem >
<SliderItem >Slide 2</SliderItem >
<SliderItem >Slide 3</SliderItem >
<SliderItem >Slide 4</SliderItem >
...
</Slider >
import { Swiper, SwiperSlide } from 'swiper/react'
export const Slider = styled(Swiper)`
/* background-color: red; */
`
export const SliderItem = styled(SwiperSlide)``
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question