title: How to get id of elements in ReactJS in function map?
body: <p>How can I get the id of a list's elements in a map function ?</p>
  
  <pre><code>export default class PhotoSlider extends Component {
      handleSort(value) {
          console.log(value)
      }
  
      render() 
      {
          return photo.map((entry, index) =&gt; &lt;Link to='#' onClick={() =&gt; this.handleSort(entry.id)}&gt;... &lt;/Link&gt;)
      }
  }
  </code></pre>
  
  <p>The console only prints the id of the last element</p>
  
  <p><a href="https://i.stack.imgur.com/Goh15.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Goh15.png" alt="enter image description here"></a></p>
  
  <p><code>in cnsole when click on links</code></p>
  
  <p><a href="https://i.stack.imgur.com/LmsmB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LmsmB.png" alt="enter image description here"></a></p>