score:7

Accepted answer

remove curly brace:

const connectedlist = ({ articles }) =>(
   articles.map(e=>( // implicit return
      <li key={e.id}>{e.title}</li>
   )
));

or, using curly brace:

const connectedlist = ({ articles }) => { // no parentheses
   return articles.map(e=>( // explicitly use return
      <li key={e.id}>{e.title}</li>
   )
});

using curly brace in parentheses indicates that you're returning an object. but articles.map... is obviously not an object rather looping through an object.


Related Query

More Query from same tag