Skip to content

Commit df6d219

Browse files
committed
Reset typing animation on text change
Added a useEffect hook to reset the typing animation state whenever the displayed text changes, ensuring the animation restarts correctly for new content.
1 parent 4c6fe07 commit df6d219

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ export default function HomePage() {
5151
]
5252
const [currentTechIndex, setCurrentTechIndex] = useState(0)
5353

54+
// Reset typing animation when language (text) changes
55+
useEffect(() => {
56+
setTypedText("")
57+
setIsTyping(true)
58+
}, [fullText])
59+
5460
// Typing animation effect
5561
useEffect(() => {
5662
if (!isTyping) return

0 commit comments

Comments
 (0)