ReactJS
What is cleanup function in useEffect?
Cleanup function is used to clean up side effects before component unmount or before the next effect runs.
Practice exam-ready one liner questions for Interview Practice with quick answers for SSC, Railway, Banking and competitive exams.
Total Questions: 54
Cleanup function is used to clean up side effects before component unmount or before the next effect runs.
API calls can be made inside useEffect and the response can update the component state.
useEffect with empty dependency array behaves like componentDidMount.
useEffect runs after rendering while useLayoutEffect runs before the browser paints.
Copyright 2026 Exambodh - aptitude, reasoning & verbal practice.