When should I use curly braces for ES6 import?

后端 未结 11 922
借酒劲吻你
借酒劲吻你 2020-11-21 09:46

It seems to be obvious, but I found myself a bit confused about when to use curly braces for importing a single module in ES6. For example, in the React-Native project I am

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-21 10:36

    The curly braces ({}) are used to import named bindings and the concept behind it is destructuring assignment

    A simple demonstration of how import statement works with an example can be found in my own answer to a similar question at When do we use '{ }' in javascript imports?

提交回复
热议问题