Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Commit 2223ae8

Browse files
committed
fix(arrow left right): code review changes for calculating lastIndex in renderArrowRight function
1 parent 7ab5693 commit 2223ae8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/Carousel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ export default class Carousel extends Component {
631631
*/
632632
renderArrowRight = () => {
633633
const { value, children, slides } = this.props;
634-
const lastSlideIndex = slides ? slides.length - 1 : React.Children.count(children) - 1;
634+
const lastSlideIndex = (slides ? slides.length : React.Children.count(children)) - 1;
635635

636636
if (this.getProp('arrowRight')) {
637637
return this.renderArrowWithAddedHandler(this.getProp('arrowRight'), this.nextSlide, 'arrowRight');

0 commit comments

Comments
 (0)