title: React login validation with useEffect
body: <p>I am trying to implement login in my react application with hooks. I am using useEffect hook to call the api to get the credentials. After receiving the credentials I am updating the state in context. But It seems the state is not updating. What I am doing wrong?</p>
  <pre><code>useEffect(() =&gt; {
              async function fetchdata(){
              try {
                  var url = 'http://localhost:3292/ExamService.svc/getuser/'+ user +'/'+ pass;
                  var output = await fetch(url).then((result) =&gt; result.json());
                  setLogUser(output[0].Name); 
                  setIslogin(true); 
              }
              catch {
                  console.log('error')
              }
          }
  
          if(isLoading === true){
              fetchdata();
          }
           
      },[isLoading])
  
    const handleSubmit = () =&gt; {
      
      setLoading(true);
      console.log(isLogin); // it is coming false
      
    }
  </code></pre>