title: How to disable page based on database(firebase) query?
body: <p>I am new to react  and  firebase and currently developing and application as  my final year project</p>
  
  <p><strong>PROBLEM:</strong> </p>
  
  <p>There are two pages in my application  <strong>PAGE 1 &amp; PAGE2</strong> ,
  I want to disable PAGE 1 until PAGE 2 is data entered (Should check only intial record when app is installed )</p>
  
  <p><strong>CODE:</strong></p>
  
  <p><strong>CODE INSIDE PAGE 1</strong></p>
  
  <pre><code>componentDidMount() {
  firebase.database().ref(`/users/${awcid}/Timeline/Page2/`)
       .orderByChild('Page2date')
       .limitToLast(1)
       .once('value', checkifexists =&gt; {
         const datafff = firebaseLooper(checkifexists);
         console.log("checkifexists", datafff.length);
          const temp=datafff.length;
         if ((temp &gt;= 1)) {
           this.setState({
             checkifexists: temp
           });
           console.log( "--------checkifexists--------","IF CONDITION",this.state.checkifexists, "----------------");
         } else {
           this.setState({
             checkifexists: 0
           });
           console.log("ELSE CONDITION");
         }
       });
  }
  </code></pre>
  
  <p><strong><em>INSIDE RENDER</em></strong></p>
  
  <pre><code>   {!(parseInt(this.state.checkifexists) &gt;= parseInt(1)) ? 
   &lt;View style={styles.notexists} &gt;
  &lt;Text style={{ color: '#FFFFFF', textAlign: 'center', alignItems: 'center', }}&gt;Please enter stock page initially to access this page{'\n'}&lt;/Text&gt;
  &lt;/View&gt; :
           :&lt;View&gt;&lt;Text&gt;Display the form&lt;/Text&gt;&lt;/View&gt;}
  </code></pre>
  
  <p>This code works fine but it checks everytime when page1 is loaded <strong><em>(instead of checking initially)</em></strong> </p>