opendevs
opendevs logo
CoursesInterviewsBlogs

Cleanup in useEffect

Solidify your knowledge of Component Lifecycle Phases by solving this problem.
Prevent infinite updates in useEffect

Dogendar 🐶 has a cleanup obsession - he always try to put things back where they were once he's done playing.

Today, he wants to play with the title of the page (it's the text that you see in the browser tab). He wants to set the page title to Dev11 when the React component mounts and once he's bored and wants to close the app (unmount the component), he wants to restore the original page title, i.e. set the page title to what it was initially.

Help Dogendar finish the component and fulfil these requirements:

  • Set the page title to Dev11 when the component mounts
  • Restore the original page title when component unmounts

Solve this medium problem to earn  2  DevCoin image
Output
Coding Area
opendevs logo
CoursesFAQsContact UsPrivacy PolicyTerms Of Service
Copyright © 2023 opendevs
Learn ● Develop ● Ace
All illustrations by Storyset