title: Maximum update depth exceeded in useFocusEffect
body: <p>I'm running <code>useFocusEffect</code> to make an API call(with reactQuery), but I'm having this error:</p>
  <p><code>Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.</code></p>
  <p>This is the specific code that throwns the error, I'm don't know if error comes from reactQuery <a href="https://react-query.tanstack.com/guides/mutations" rel="nofollow noreferrer">useMutation</a> or from <a href="https://reactnavigation.org/docs/use-focus-effect/" rel="nofollow noreferrer">useFocusEffect</a> from react navigation:</p>
  <pre class="lang-js prettyprint-override"><code>export const OrderStatementLoading = () =&gt; {
    const {  
      mutateAsync: createSchedulePayment,
      isLoading: isLoadingSave,
      isSuccess: isSuccessSave,
      reset,
    } = useMutation(//...useMutationParams);
  
    useFocusEffect(
      useCallback(() =&gt; {
        createSchedulePayment()
          .then(() =&gt; console.log('success'))
          .catch(() =&gt; console.log('error'))
          .finally(() =&gt; {
            reset();
          });
      }, [reset, createSchedulePayment]),
    );
  
    return {// redered content}
  };```
  </code></pre>