title: How can I fetch data only once with render?
body: <p>I'm trying to fetch data only once at the beginning of the rendering, I'm trying to use <strong>start</strong> variable to control in case I need to fetch again</p>
  <pre><code>const [data, setData] = useState();
  const [start, setStart] = useState(true);
  
  const getData = async () =&gt; {
      console.log('getting data');
      const res = await axios.get(url);
      setData(res.data);
      setStart(false);
  };
  
  let count = 0;
  
  useEffect(() =&gt; {
    if (start === true) {
      getData();
      console.log('Render: ', count);
      count++;
    }, [start])
  </code></pre>
  <p>count is just to count the renderers, and I'm getting more than one, always, even without dependencies in the useEffect hook I get 2.</p>
  <p>Do you have any suggestions?</p>