What do curly braces around a variable in a function parameter mean

前端 未结 2 805
予麋鹿
予麋鹿 2020-12-24 09:36

I saw this code on a package:

const SortableList = SortableContainer(({items}) => {
 return (
     
    {items.map((value, index) =>
2条回答
  •  时光说笑
    2020-12-24 09:51

    This question is likely a repost: What do {curly braces} around javascript variable name mean

    But as an answer, it's destructuring assignment. If your object being passed in mirrors the variable being referenced, you can retrieve that specific field during assignment.

提交回复
热议问题