0
import EventItem from "./event-item";

function EventList(props){
    const {items}=props;
    return(
       <ul>
           {items.map((event)=>{
               <EventItem />
           })}
       </ul>
    )
}
export default EventList;
adiga
  • 34,372
  • 9
  • 61
  • 83

3 Answers3

1

This is an object destructuring assignment.

It means that items will be set to the value of props.items (i.e. the items property of the passed object).

Alnitak
  • 334,560
  • 70
  • 407
  • 495
1

item in this case is a property of the object. the operation performed here is Destructuring assignment

object = { a: 10, b: 20 }
({ a, b } = object);
console.log(a); // 10
console.log(b); // 20
0

here, item is one of prop's key which pass from parent.. const {items}=props; here with Object destructuring concept we use directly items key of props.. you can read more about below link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

Divyesh Joshi
  • 81
  • 1
  • 6