리엑트에 swiper 붙이는 걸 해보자!
설치
npm i swiper
사용법
// Import Swiper React components
import { Swiper, SwiperSlide } from 'swiper/react';
// Import Swiper styles
import 'swiper/css';
export default () => {
return (
<Swiper
spaceBetween={50}
slidesPerView={3}
onSlideChange={() => console.log('slide change')}
onSwiper={(swiper) => console.log(swiper)}
>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
<SwiperSlide>Slide 4</SwiperSlide>
...
</Swiper>
);
};
출처
Swiper - The Most Modern Mobile Touch Slider
Swiper is the most modern free mobile touch slider with hardware accelerated transitions and amazing native behavior.
swiperjs.com
'Development > React.js' 카테고리의 다른 글
Styled Components를 Global에서 사용하기 (0) | 2022.05.02 |
---|---|
React Hooks에서 setInterval() 사용 문제 (0) | 2022.05.02 |
Next.js의 Image를 사용하기 (0) | 2022.04.30 |
[REACT] 리액트에서 줄바꿈 처리 (0) | 2022.04.30 |
[React] Styled-Components를 이용한 애니메이션 (0) | 2022.04.30 |