Skip to content

Commit b0bdb7c

Browse files
author
dylan.zeng
committed
šŸžfix(carousel): update useEffect dependencies and use function dispatcher in setPage state
1 parent 2e40ffb commit b0bdb7c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ā€Žsrc/components/carousel/index.tsxā€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export const Carousel: FunctionComponent<CarouselProps> = (userProps: CarouselPr
7070
prevChildren?.length < props.children.length
7171
) {
7272
slide(SlideDirection.Right);
73-
setPage(page + 1);
73+
setPage((page: number) => page + 1);
7474
}
75-
}, [props.children]);
75+
}, [ props.dynamic, props.children, props.slide, props.infinite, props.pageCount ]);
7676

7777
useEffect(() => {
7878
autoSwipe();

0 commit comments

Comments
Ā (0)