1useEffect(() => {
2    function handleStatusChange(status) {
3      setIsOnline(status.isOnline);
4    }
5    ChatAPI.subscribeToFriendStatus(props.friend.id, handleStatusChange);
6    // Specify how to clean up after this effect:
7    return () => {
8      ChatAPI.unsubscribeFromFriendStatus(props.friend.id, handleStatusChange);
9    };
10  });1import React, { useEffect } from 'react';
2
3export const App: React.FC = () => {
4  
5  useEffect(() => {
6        
7  }, [/*Here can enter some value to call again the content inside useEffect*/])
8  
9  return (
10    <div>Use Effect!</div>
11  );
12}1useEffect(() => {
2  window.addEventListener('mousemove', () => {});
3
4  // returned function will be called on component unmount 
5  return () => {
6    window.removeEventListener('mousemove', () => {})
7  }
8}, [])