개발하는 루루언니

슬라이드로 만들고 싶으면? react-multi-carousel 본문

컴퓨터 정보/리액트

슬라이드로 만들고 싶으면? react-multi-carousel

혜닝혜루 2022. 11. 1. 14:58
728x90
반응형

https://www.npmjs.com/pack

 

react-multi-carousel

Production-ready, lightweight fully customizable React carousel component that rocks supports multiple items and SSR(Server-side rendering) with typescript.. Latest version: 2.8.2, last published: 4 months ago. Start using react-multi-carousel in your proj

www.npmjs.com


슬라이드 만들기 

0

 

 

npm

npm install react-multi-carousel --save

import ( 내가 만들 슬라이스 파일에)

import Carousel from 'react-multi-carousel';
import 'react-multi-carousel/lib/styles.css';

Minimum working set up. 을 이용해서 만들어보기 

import React from 'react'
import Carousel from 'react-multi-carousel';
import 'react-multi-carousel/lib/styles.css';
const responsive = {
  superLargeDesktop: {
    // the naming can be any, depends on you.
    breakpoint: { max: 4000, min: 3000 },
    items: 5
  },
  desktop: {
    breakpoint: { max: 3000, min: 1024 },
    items: 3
  },
  tablet: {
    breakpoint: { max: 1024, min: 464 },
    items: 2
  },
  mobile: {
    breakpoint: { max: 464, min: 0 },
    items: 1
  }
};
const MoviSlide = ({movies}) => {
  return (
    <div>
      <Carousel responsive={responsive}>
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
  <div>Item 4</div>
</Carousel>;
    </div>
  )
}

export default MoviSlide

결과 창

 

728x90