3/31/2018 - 6:52 PM

ReactJs - Key

A “key” is a special string attribute you need to include when creating lists of elements.

Keys help React identify which items have changed, are added, or are removed. Keys should be given to the elements inside the array to give the elements a stable identity:

The best way to pick a key is to use a string that uniquely identifies a list item among its siblings. Most often you would use IDs from your data as keys:

/*KEYS */

const listItem ={
  return (
      <div key={item.objectID}> 
            <a href="{item.url}">{item.title}</a>
          <span>Author: {}</span>
          <span>Comments: {item.num_comments}</span>
          <span>Points: {item.points}</span>