title: is a Function which using useeffect which returns only response of api can be callable in method of another component?
body: <p>i just read up the documentation of react useEffect , and they put this example</p>
  
  <pre><code>import React, { useState, useEffect } from 'react';
  
  function FriendStatus(props) {
  const [isOnline, setIsOnline] = useState(null);
  
  useEffect(() =&gt; {
  function handleStatusChange(status) {
    setIsOnline(status.isOnline);
  }
  
  ChatAPI.subscribeToFriendStatus(props.friend.id, handleStatusChange);
  // Specify how to clean up after this effect:
  return function cleanup() {
    ChatAPI.unsubscribeFromFriendStatus(props.friend.id, handleStatusChange);
  };
  });
  
  if (isOnline === null) {
    return 'Loading...';
  }
   return isOnline ? 'Online' : 'Offline';
  }
  </code></pre>
  
  <p>According to this example <strong>can i use this in my any method of some other component</strong> ? if yes then how ? should i have to make that method async . </p>