title: Save axios response to state react hooks
body: <p>I am trying to save the response I get from Axios to state using hooks.  However, whenever I attempt to use the hook, the  component continues to re-render an unlimited number of times.</p>
  
  <pre><code>const [orders, setOrders] = useState([]);
  
  const getUserOrders = async () =&gt; {
          await API.getOrders(window.sessionStorage.id)
              .then(res =&gt; setOrders(res.data.ordersArr))
              .catch(err =&gt; console.log(err));
  }
  useEffect(() =&gt; {
          if (logged_in) {
              getUserOrders();
          } else {
              window.location.href = "/login";
          }
  }, [orders])
  </code></pre>
  
  <p>If I console log res.data.ordersArr instead of using the setOrders hook, I am able to see the expected data.  When I use the hook, it keeps re-rendering.</p>