Component Lifecycle: Unmounting

Test your knowledge of the unmounting phase in React component lifecycle with this comprehensive quiz.

20 questions · free · answers explained

Start the quiz

All questions in this quiz

  1. What is the unmounting phase in React's component lifecycle?
  2. Which lifecycle method is called during the unmounting phase in class components?
  3. In functional components, what is the equivalent of componentWillUnmount?
  4. What happens if you forget to clean up subscriptions in the unmounting phase?
  5. Which of the following is NOT a reason for a component to unmount?
  6. What are common resources to clean up in componentWillUnmount or useEffect cleanup?
  7. How does the dependency array in useEffect relate to cleanup?
  8. In what order do unmounting lifecycle methods execute when a parent and child component both unmount?
  9. What can happen if an asynchronous operation tries to update state after a component unmounts?
  10. What is a common pattern to prevent state updates on unmounted components?
  11. How do keys in React lists affect component unmounting?
  12. What's the difference between a component being unmounted versus suspended?
  13. How can you test if a component's unmounting cleanup works correctly?
  14. What happens if an error is thrown during the unmounting phase?
  15. Why should unmounting operations be fast?
  16. How does unmounting a component affect Context providers and consumers?
  17. What happens to refs when a component unmounts?
  18. How does unmounting work with React Portals?
  19. How does React StrictMode affect component unmounting?
  20. What's a recommended pattern for managing async operations when components might unmount?

Prefer to read first? React interview questions with written answers.