DeepFrontend
Learning Paths
Practice
System Design & DS
Design Studio
Data Structures Curriculum
Real-World Case Studies
Careers
Job Board
Resume Builder
Blog
Sign in
Search
⌘K
Go Pro
Loading compiler resources...
CSS Quiz Practice
Active Recall Drill Session
← Exit Session
Question 1 of 1
medium
CSS
In a React component using GSAP to create an animation timeline inside a useEffect, why is a cleanup function (`return () => tl.kill()`) necessary?
A
It's purely optional styling preference
B
Without it, the GSAP timeline can keep running or referencing DOM nodes after the component unmounts, causing memory leaks and potential console errors
C
GSAP requires cleanup only in class components, not function components
D
It improves animation frame rate
Check Answer