Cleanup in useEffect
Solidify your knowledge of Component Lifecycle Phases by solving this problem.
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
Dev11when the component mounts
- Restore the original page title when component unmounts