From 32a7a5f180b4361dc21e4eafbaa54a21fb52cb77 Mon Sep 17 00:00:00 2001 From: Hasan Genc Date: Fri, 19 Jun 2020 16:26:27 +0300 Subject: [PATCH] Update items on children state changes. --- src/components/carousel/index.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/carousel/index.tsx b/src/components/carousel/index.tsx index f98eadd..acbeffa 100644 --- a/src/components/carousel/index.tsx +++ b/src/components/carousel/index.tsx @@ -29,6 +29,10 @@ export const Carousel: FunctionComponent = (userProps: CarouselPr getShowArrow(props.children.length, props.show, props.infinite, current), ); + React.useEffect(() => { + setItems(initItems(props.children, props.slide, props.infinite)); + }, userProps.children); + const slide = (direction: SlideDirection, slide: number): void => { if ( animation.isSliding ||