title: React native Reference child failed
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { width: WIDTH } = Dimensions.get('window');
  var today = new Date();
  var dd = today.getDate();
  var mm = today.getMonth() + 1;
  var yyyy = today.getFullYear();
  if (dd &lt; 10) {
      dd = '0' + dd;
  }
  if (mm &lt; 10) {
      mm = '0' + mm;
  }
  today = mm + dd + yyyy;
  
  class Attendance extends Component {
      state = {
          image: null,
          submit: false,
          loading: false,
          face: null,
          confidence: 0,
          class: '',
          flag: ''
      };
      async componentDidMount() {
          await Permissions.askAsync(Permissions.CAMERA);
          const { currentUser } = firebase.auth();
          firebase
           .database()
           .ref('users/')
           .child(currentUser.uid)
           .on('value', snap =&gt; 
              this.setState({ 
                  face: snap.val().image,
                  class: snap.val().stream_sem
              })
           );
      }
      render(){
          return(
              &lt;View style={styles.Conatiner}&gt;
                  &lt;Loader loading={this.state.loading} /&gt;
                  {this.renderContent()}
              &lt;/View&gt;
          );
      }
      renderContent = () =&gt;  {
          firebase.database().ref('attendance')
          .child(this.state.class)
          .child(today)
          .on("value", snap =&gt; {
              this.setState({ flag: snap.val().flag});
          });
          if(this.state.flag === "0") {
              //**something**
          }
          else {
              //**something**
          }
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>When i am trying to write <code>this.state.class</code>, it is showing reference child failed. <a href="https://i.stack.imgur.com/E6BZ9.jpg" rel="nofollow noreferrer">Here</a>  is the error detail i am getting.
  My firebase database <a href="https://i.stack.imgur.com/DiFoA.png" rel="nofollow noreferrer">Picture</a> is here. Can you please tell where i am going wrong. I want to access "flag" part of the database. <code>CSE8</code> should match with the users <code>stream_sem</code>
  ThankYou in advance</p>