FAQ: Updating/Unmounting Lifecycle Methods - componentWillUnmount

This community-built FAQ covers the “componentWillUnmount” exercise from the lesson “Updating/Unmounting Lifecycle Methods”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn ReactJS: Part II

FAQs on the exercise componentWillUnmount

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I just finished the exercise for Lifecycle Methods (componentWillUnmount) and I’m a bit miffed as to why we need to insert parameters for prevProps and prevState when we don’t call either of those parameters.

Here is the code from the exercise:

  componentWillUnmount(prevProps, prevState) {
    clearInterval(this.interval);
  }

Why do we need to specify prevProps and prevState?

I am a Windows user and cannot for the life of me figure out how to “refresh” the page to move to the next step. Please help. I have tried Ctrl+R, F5, Refresh button on the built-in browser, refresh button on my browser.

1 Like

Found out that you can simply press the “Run” button once more to get past this step.