component did mount and unmount in react as functional components code example
Example: didMount in functional component
useEffect(() => { fetch(url) .then(resp => resp.json()) .then(data => this.setState() }, [])
useEffect(() => { fetch(url) .then(resp => resp.json()) .then(data => this.setState() }, [])