title: How to add a React Key on a object
body: <p>So I have a object that I need to put a react key due to the virtual dom, I know its very easy to add a react key to an array using map, but what about objects?</p>
  
  <p>Any feedback would be greatly appreciated.</p>
  
  <pre><code>import React, {Component} from 'react';
  
  export default class ViewAllAnswers extends Component {
    render() {
      const self = this;
      const submittedAnswers = self.props.submittedAnswers;
      var submittedAnswerSlides = [];
  
      for (var key in submittedAnswers) {
        if (submittedAnswers.hasOwnProperty(key)) {
          submittedAnswerSlides.push(
             &lt;div className="flex"&gt;
              &lt;div&gt;
                &lt;div className="flex answer p20"&gt;
                 {submittedAnswers[key].answer}
                &lt;/div&gt;
              &lt;/div&gt;
             &lt;/div&gt;
          );
        }
      }
  
  
          return (
            &lt;div className="paper"&gt;
              {submittedAnswerSlides}
            &lt;/div&gt;
          )
  
    }
  }
  </code></pre>