1. Third-Party Package - react-slick
NPM contains a react-slick, a third-party package that provides a React component Slider to add a carousel to your application.
Installation Command:
Also, install slick-carousel for CSS and font
1.1 Advantages
- Easy to use
- Highly customizable
- More performant
2. Slider Props
We can provide different props to the Slider component. Below are the most commonly used props.
Prop | Description | Default Value |
---|---|---|
slidesToShow | Specifies the number of slides to show in one frame | 1 |
dots | If set to false, no dots will display under the carousel | true |
slidesToScroll | Specifies the number of slides to scroll at once | 1 |
dotsClass | CSS class for styling dots | "slick-dots" |
Example:
File: src/components/ReactSlick/index.js
JSX
File: src/components/ReactSlick/index.css
CSS
File: src/App.js
JSX