title: Why my currentQuestion(variable) not getting updated here:
body: <pre><code>  const [currentQuestion,setCurrentQuestion]=useState(0);
    useEffect(()=&gt;{
      console.log(currentQuestion)       //checking currentQuestion
    },[currentQuestion])
  
    function func_setter(id){
       if(id&lt;3)
       {
         id=id+1;
         setCurrentQuestion(id);  //changing the id
       }
       
    }
  
     &lt;Quiz problem={questions[currentQuestion]} function_call={()=&gt;{func_setter()}}&gt;&lt;/Quiz&gt;
            //function_call is a prop passed to Child Component to  change the currentQuestion upon userClick
  
   &lt;Button color=&quot;success&quot; className=&quot;centerer&quot; onClick={(e)=&gt;     //button is in the child Component of App.js
  {props.function_call(props.problem.id)}}&gt;Save and Next&lt;/Button&gt;  //button to change the question
  </code></pre>
  <p>Here my Child Component isnt able to change the state of a variable present  in the parent component..</p>