title: Calling function defined using useCallback after setting the state on which it depends
body: <p>I defined a function using useCallback, depending on a state. I want to call this function from another, which change the state before calling it and defined using useCallback as well. How can I do?</p>
  <p>Example:</p>
  <pre><code>const refreshPage = useCallback(
      () =&gt; {
          if (state == '1')
              // action
      },
      [state]
  );
  
  const onChangeText = useCallback(
      (state) =&gt; {
          setState(state);
          refreshPage();
      },
      [refreshPage]
  );
  </code></pre>
  <p>Here, when onChangeText will be called, it will update the state and the definition of <code>refreshPage</code>, but it will not call <code>refreshPage</code> with the new state I defined.</p>
  <p>I precise that it's only an example and and I use useEffect to load data.</p>
  <p>Thanks!</p>