Now that we have finished up with our map app, let's do a little cleaning up! Here we are going to go through our Location Event Handler and clean it up for when the page unmounts.
Colby Fayock: [0:00] Anytime we create an event listener, we want to try to be thoughtful and clean those up on the component unmounts. This way, we don't have any stray resources being hung up.
[0:07] To do this, our useEffect hook lets us return a statement to run after unmounts. We're going to tell this to return a new function, or we're going to tell our map to turn off our location found event along with that function.
[0:18] When we go to the browser and click Find My Location, we're not going to see anything different, but now we know we're going to be cleaning up those resources whenever it unmounts.