title: React setTimeout and clearTimeout
body: <p>Recently I am creating a website using React and I found out that I kind of use a lot of 'setTimeOut()' and I know that from React documentation sometimes you need to clean up some things when component unmount(To be honest, I am not fully understand about this clean up thing), apparently recently I saw a posts saying that 'setTimeOut()' need to be clean up too but how do I clean up functions that I call in 'useEffect()' which I am using 'setTimeOut()' inside the function?</p>
  
  <p><strong>Here are my codes:</strong></p>
  
  <pre><code>  useEffect(() =&gt; {
      createContent();
      handleMobileContainerView();
    });
  
  
    const createContent = () =&gt; {
      if (contentCompShowStatus) {
        for (let key in btnStatus) {
          if (btnStatus.hasOwnProperty(key)) {
            if (btnStatus[key] === true) {
              if (key === 'aboutBtn') {
                 delayContent('about-contents');
              } else if (key === 'skillsBtn') {
                 delayContent('skills-contents');
              } else if (key === 'projectsBtn') {
                 delayContent('projects-contents');
              }
            }
          }
        }
      }
    };
  
  
    const delayContent = (content) =&gt; {
      if (firstTime) {
        setTimeout(() =&gt; {
          setCurrentContent(content);
          setFirstTime(false);
        }, 200);
      } else if (!firstTime) {
        setTimeout(() =&gt; {
          setCurrentContent(content);
        }, 450);
      }
    };
  </code></pre>
  
  <p>As you can see above codes, 'createContent()' is in 'useEffect()' and is calling a function name 'delayContent()' which is using 'setTimeout()'.</p>
  
  <p><strong>Do I need to do clean up with this kind of case?</strong></p>
  
  <p><strong>How do I do clean up with this kind of case? (function inside of function which is using 'setTimeOut()' and is called in 'useEffect()')</strong></p>