Replacing componentWillUnmount with hooks

Data cleanup is an important aspect to keep in mind whenever building a front end application using React. Often times we as developers need to set an interval in which a certain function runs. What happens once the component is unmounted? It's critical that this interval be removed in order for the application to remain performant and not waste resources.