title: how awoid 2 times re render in react-native
body: <p>i have tried to do routing according to user check and i did but my method worked two times. i understand it from my log</p>
  
  <p>i'm using redux and here is my "useeffect" in mainrouter.js</p>
  
  <pre><code>// currentUser : null // in  initialState for users
  
  useEffect(() =&gt; {
      if(states.currentUser== null)
      {
          console.log("Checking user for routing");
          actions.getCurrentUserACT();
      }
      else{
          console.log("Logged in")
      }
  },[]);
  </code></pre>
  
  <p>my mainrouter.js return</p>
  
  <pre><code> return (
      &lt;NavigationContainer&gt;
          {
              states.currentUser == null ?
                  (this.SignStackScreen()) :
                  (this.MainTabNavigator())
          }
      &lt;/NavigationContainer&gt;
  );
  </code></pre>
  
  <p>here is my "getCurrentUserAct" method in redux actions</p>
  
  <pre><code>export function getCurrentUserACT() {
  return function (dispatch) {
  
      firebase.auth().onAuthStateChanged(user =&gt; {
          if (user) {
              console.log("User authed..");
              dispatch({type:actionTypes.CURRENT_USER,payload:user})
          } else {
              console.log("User notauthed..");
              dispatch({type:actionTypes.CURRENT_USER,payload:null})
          }
      });
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/HDZvN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HDZvN.png" alt="enter image description here"></a></p>
  
  <p>when my app start, logs are .. (if i logged in before)</p>
  
  <ul>
  <li>Checking user for routing </li>
  <li>User authed </li>
  <li>User authed</li>
  </ul>
  
  <p>i think the reason for this, useeffect worked first time and state changed which use in return and rerender"
  but then i removed to condition, logs were same. </p>
  
  <p>so how i can avoid this? 
  is there a way to run method before from useeffect and avoid second render? or wait data in useeffect?</p>