title: useState function is not working in functional component
body: <p>I want to change a state (<code>filterConsultantId</code>) with a useState function (<code>setFilterConsultantId</code>) after I trigger a normal function (<code>handleConsultantChange</code>) and I expect the state value is changed when I use the state in another normal function (<code>getActiveLeads</code>). But the state didn't change. Please see my React functional component below:</p>
  <pre><code>const TabActiveLeads = ({
      ...
  }) =&gt; {
      const [filterConsultantId, setFilterConsultantId] = useState('');   
      
      //after this arrow function triggered, 
      const handleConsultantChange = (event) =&gt; {
          setFilterConsultantId(event.target.value); //and the filterConsultantId should be changed here
          
          //this getActiveLeads function is called
          getActiveLeads();
      };
      
      const getActiveLeads = () =&gt; {
          
          // but the filterConsultantId here is not changed after it should be changed inside handleConsultantChange function
          console.log(filterConsultantId);
      }; 
  };
  
  export default TabActiveLeads;
  </code></pre>
  <p>I don't understand, why <code>filterConsultantId</code> is not changed inside the <code>getActiveLeads</code> function? Previously it should be changed by calling <code>setFilterConsultantId</code> inside the <code>handleConsultantChange</code> function.</p>
  <p>Thanks for any help..</p>