title: Get key from an object in an array in react-native
body: <pre><code>constructor(props) {
      super(props);
      this.state = ({
          childData: [],
          test: []
      });
  }
  
  componentDidMount() {
      let userId = firebase.auth().currentUser.uid;
      firebase.database().ref('poolog/' + userId).on('value', (snapshot) =&gt; {
         let test = [];
         snapshot.forEach((childSnapshot) =&gt; {
            let childKey = childSnapshot.key;
            test.push(snapshot.val());
          });
          this.setState({childData: test});
          // console.log(this.state.childData);
      });
  </code></pre>
  
  <p>I use this function in the return method of React.</p>
  
  <pre><code> {this.state.childData.map((item, key) =&gt;
       &lt;View key={key}&gt;
          {console.log(Object.values(item) + 'test')}
          &lt;Text&gt;{Object.keys(item)}&lt;/Text&gt;
          {Object.values(item).map((value, index) =&gt;
            &lt;View&gt;&lt;/View&gt;
          )}
       &lt;/View&gt;
    )}
  </code></pre>
  
  <p>I have a question, I only want a specific value, <code>Object.values(item)</code> gives all the values, and when I use <code>Object.values(item[key])</code> or <code>Object.values(item[0])</code> I get:</p>
  
  <blockquote>
    <p>TypeError: undefined is not an object (evaluating 'Object.keys(item[0]')
    or
    TypeError: undefined is not an object (evaluating 'Object.keys(item[key]')</p>
  </blockquote>
  
  <p>And <code>{console.log(Object.values(item) + 'test')}</code> gives the following output:</p>
  
  <pre><code>[object Object],[object Object],[object Object],[object Object]test
  [object Object],[object Object],[object Object],[object Object]test
  [object Object],[object Object],[object Object],[object Object]test
  [object Object],[object Object],[object Object],[object Object]test
  </code></pre>
  
  <p>How can I fix this, that I only get a specific object from this.</p>
  
  <pre><code>&lt;Text&gt;Object.values(item)&lt;/Text&gt;
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>    10-1-201910-5-2019-10-9-2019-9-5-2019
      10-1-201910-5-2019-10-9-2019-9-5-2019
      10-1-201910-5-2019-10-9-2019-9-5-2019
      10-1-201910-5-2019-10-9-2019-9-5-2019
  </code></pre>