useCarousel
Last updated
Last updated
The useCarousel hook is used inside the component. This hook handles the slider logic, inside the Carousel component.
This hook is an internal hook and is not available for the users since it's not exposed as a part of this library.
It accepts two parameters - a initialValue
, which is an integer (default value is zero) and imagesListLength
- the array length containing source links for each image.
It returns the following:
currentSlide
- index of the current slide.
handleLeftArrow
- function to manage previous button click.
handleRightArrow
- function to manage right button click.
As you can see above it uses the hook of the React internally for managing the state of slider on arrow click.