title: How to set interval in react js first time 0 sec after that 30 sec?
body: <p>How to set interval in react js first time 0 sec after that 30 sec?</p>
  <pre class="lang-js prettyprint-override"><code>//this is my state 
  const [state, setState] = useState();
  useEffect(() =&gt; {
      const interval = setInterval(() =&gt; {
      APiResponse();
      }, 30000);
      return () =&gt; clearInterval(interval);
  }, []);
  
  const APiResponse = () =&gt; {
      axios.get(`xxx`).then((res) =&gt; {
      setState(res);
      });
  };  
    
  
  </code></pre>