Give Sibling Elements a Unique Key Attribute -- can I use the Spread ... Operator?

Give Sibling Elements a Unique Key Attribute -- can I use the Spread ... Operator?
0

#1

Tell us what’s happening:

Challenge worked fine with item,key system with .map . I’m wondering if I can use the spread … operator somehow but it doesn’t seem to have an index or sub key. Is this the case? Thanks

Your code so far



const frontEndFrameworks = [
  'React',
  'Angular',
  'Ember',
  'Knockout',
  'Backbone',
  'Vue'
];

function Frameworks() {
  const renderFrameworks = null; // I did the map thing. Can I use Spread?
  return (
    <div>
      <h1>Popular Front End JavaScript Frameworks</h1>
      <ul>
        {renderFrameworks}
      </ul>
    </div>
  );
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/give-sibling-elements-a-unique-key-attribute


#2

Not sure how you were thinking of using the spread operator to display the array. It is just a way of spreading an array and not for iterating through an array. That is why map, filter, and reduce methods exist.