title: How to call loading function with React useEffect only once
body: <p>The <a href="https://reactjs.org/docs/hooks-effect.html" rel="noreferrer">useEffect</a> React hook will run the passed-in function on every change. This can be optimized to let it call only when the desired properties change.</p>
  <p>What if I want to call an initialization function from <code>componentDidMount</code> and not call it again on changes? Let's say I want to load an entity, but the loading function doesn't need any data from the component. How can we make this using the <code>useEffect</code> hook?</p>
  <pre><code>class MyComponent extends React.PureComponent {
      componentDidMount() {
          loadDataOnlyOnce();
      }
      render() { ... }
  }
  </code></pre>
  <p>With hooks this could look like this:</p>
  <pre><code>function MyComponent() {
      useEffect(() =&gt; {
          loadDataOnlyOnce(); // this will fire on every change :(
      }, [...???]);
      return (...);
  }
  </code></pre>