title: Infinite loop when using useLazyQuery in React + Apollo/GraphQL?
body: <p>My code so far looks something like this:</p>
  <pre><code>const { ID } = useParams();
  const [getObjects, {loading, data}] = useLazyQuery(GET_OBJECTS_BY_ID);
  
  const objectWithID = props.data.find(datum =&gt; datum._id == ID);
  if (objectWithID.conditional) {
      getObjects({variables: {objectIds: objectWithID.subObjects}});
      //Do a bunch of other stuff including a separate render
  }
  else {...}
  </code></pre>
  <p>What I'm essentially doing is finding an object with the specified <code>ID</code> first, and then querying for its subObjects. I want to first find the <code>objectWithID</code> variable before querying, and then based on one of its parameters, conditionally use its value, hence I think <code>useLazyQuery</code> helps to achieve this. However, this causes an infinite loop: for some reason it's being called an infinite number of times, crashing my webpage. Am I using <code>useLazyQuery</code> incorrectly? How could I prevent this   infinite loop?</p>