title: Update a state variable only on loading the page for the first time in react js
body: <p>I have a react component and I want to update the state variable to be false when the page loads for the first time. I am using useEffect for that, but later down the page I am using a third party library that calls a function which has a function to update the same state variable to be true and that is what I want but that runs the useEffect again which makes it back to false.</p>
  <p>So, I want to make sure the state variable to be only false when we load/refresh the page</p>
  <pre><code>useEffect(() =&gt; {
      Dosomething();
      DoAnotherThing();
      changeState();
    }[Dosomething,DoAnotherThing,changeState]);
  
  return (
      &lt;&gt;
  &lt;ThirdPartyComponent&gt;
  //on Load dispatches another function
  AnotherFunction();
  &lt;/ThirdPartyComponent&gt;
  &lt;/&gt;
  )
  
  </code></pre>
  <p>Actions</p>
  <pre><code>AnotherFunction(){
   changeState(); //I want the state change to happen here but it calls the useEffect back again which makes it false
  }
  </code></pre>
  <p>So, I am trying to make sure that state variable is false only on load/refresh of the page. I am using Redux for state management</p>