We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3b9ebe7 + 29111b9 commit 647dde5Copy full SHA for 647dde5
src/components/common/Carousel/carousel.tsx
@@ -1,6 +1,6 @@
1
import { ReactJSXElement } from '@emotion/react/types/jsx-namespace';
2
import { AnimatePresence, motion } from 'framer-motion';
3
-import React, { useState } from 'react';
+import React, { useEffect, useState } from 'react';
4
5
import { TabNavMenu } from '../../navigation/tabNavMenu/tabNavMenu';
6
@@ -44,6 +44,10 @@ const Carousel = ({ names, children }: CarouselProps) => {
44
// The Direction that the card is moving in
45
const [direction, setDirection] = useState(0);
46
47
+ useEffect(() => {
48
+ setCurrentCard(0);
49
+ }, [children]);
50
+
51
/**
52
* On each re-render, ensure currentCard is within valid bounds
53
*/
0 commit comments