how to destroy a function in reactjs in componentwillunmount code example Example: component did mmount componentDidMount()